From c477ec58a916d5879d97ce0f7f25baf257eb5dcf Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sun, 26 May 2024 10:52:54 +0100 Subject: [PATCH] Rename main.py -> cli.py and add poetry pre-commit hooks Add apps section to flake.nix output to explicitly define CLI output path --- .pre-commit-config.yaml | 5 +++++ flake.nix | 12 +++++++++++- pyproject.toml | 2 +- src/nix_background_upgrade/{main.py => cli.py} | 0 4 files changed, 17 insertions(+), 2 deletions(-) rename src/nix_background_upgrade/{main.py => cli.py} (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2edfe68..0447444 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,6 +8,11 @@ repos: - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files + - repo: https://github.com/python-poetry/poetry + rev: "1.8.0" # add version here + hooks: + - id: poetry-check + - id: poetry-lock - repo: https://github.com/psf/black-pre-commit-mirror rev: 24.4.2 hooks: diff --git a/flake.nix b/flake.nix index a036494..8ec3816 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,17 @@ packages = forAllSystems (system: let inherit (poetry2nix.lib.mkPoetry2Nix {pkgs = pkgs.${system};}) mkPoetryApplication; in { - default = mkPoetryApplication {projectDir = self;}; + default = mkPoetryApplication { + projectDir = self; + checkGroups = []; + }; + }); + + apps = forAllSystems (system: { + default = { + type = "app"; + program = "${self.packages.${system}.default}/bin/nix-background-upgrade"; + }; }); devShells = forAllSystems (system: let diff --git a/pyproject.toml b/pyproject.toml index 5dfc48e..6ab8be5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ repository = "https://git.xenia.me.uk/pixelifytica/nix-background-upgrade" packages = [{include = "nix_background_upgrade", from = "src"}] [tool.poetry.scripts] -nbu = 'nix_background_upgrade.main:main' +nix-background-upgrade = 'nix_background_upgrade.cli:main' [tool.poetry.dependencies] python = "^3.9" diff --git a/src/nix_background_upgrade/main.py b/src/nix_background_upgrade/cli.py similarity index 100% rename from src/nix_background_upgrade/main.py rename to src/nix_background_upgrade/cli.py