From cebb6ccb865864f227578709165eefe1aad6f938 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Thu, 4 May 2023 16:40:30 +0200 Subject: [PATCH] Add flake.nix to project --- .gitignore | 4 ++- flake.lock | 26 ++++++++++++++ flake.nix | 44 ++++++++++++++++++++++++ pyproject.toml | 8 ++--- worblehat/{wsgi-dev.py => wsgi_dev.py} | 0 worblehat/{wsgi-prod.py => wsgi_prod.py} | 0 6 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix rename worblehat/{wsgi-dev.py => wsgi_dev.py} (100%) rename worblehat/{wsgi-prod.py => wsgi_prod.py} (100%) diff --git a/.gitignore b/.gitignore index e5eb699..4ea3da9 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,6 @@ venv.bak/ .env.production.local .env.local -dist/ \ No newline at end of file +dist/ + +result \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..40d199a --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1683014792, + "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..776e212 --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + # inputs.nixpkgs.url = "nixpkgs/nixos-22.11"; + inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs }: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + inherit (pkgs) lib; + in { + apps.${system} = let + app = program: { + type = "app"; + inherit program; + }; + in { + default = self.apps.${system}.dev; + dev = app "${self.packages.${system}.worblehat}/bin/dev"; + scanner = app "${self.packages.${system}.worblehat}/bin/scanner"; + }; + + packages.${system} = { + default = self.packages.${system}.worblehat; + worblehat = with pkgs.python3Packages; buildPythonPackage { + pname = "worblehat"; + version = "0.1.0"; + src = ./.; + + format = "pyproject"; + + buildInputs = [ poetry-core ]; + propagatedBuildInputs = [ + alembic + click + flask + flask-admin + flask-sqlalchemy + isbnlib + python-dotenv + sqlalchemy + ]; + }; + }; + }; +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 19e8493..376bd25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,22 +7,22 @@ license = "MIT" readme = "README.md" [tool.poetry.dependencies] -alembic = "^1.10.4" +alembic = "^1.9.4" click = "^8.1.3" -flask = "^2.3.2" +flask = "^2.2.2" flask-admin = "^1.6.1" flask-sqlalchemy = "^3.0.3" isbnlib = "^3.10.14" python = "^3.10" python-dotenv = "^1.0.0" -sqlalchemy = "^2.0.12" +sqlalchemy = "^2.0.8" [tool.poetry.group.dev.dependencies] werkzeug = "^2.3.3" [tool.poetry.scripts] scanner = "worblehat.tools.scanner:main" -dev = "worblehat.wsgi-dev:main" +dev = "worblehat.wsgi_dev:main" [build-system] requires = ["poetry-core"] diff --git a/worblehat/wsgi-dev.py b/worblehat/wsgi_dev.py similarity index 100% rename from worblehat/wsgi-dev.py rename to worblehat/wsgi_dev.py diff --git a/worblehat/wsgi-prod.py b/worblehat/wsgi_prod.py similarity index 100% rename from worblehat/wsgi-prod.py rename to worblehat/wsgi_prod.py