diff --git a/flake.nix b/flake.nix index ff5ba50..60f5ccf 100644 --- a/flake.nix +++ b/flake.nix @@ -93,6 +93,10 @@ path = ./templates/poetry; description = "Poetry template"; }; + python = { + path = ./templates/python; + description = "Legacy Python template"; + }; }; }; diff --git a/templates/python/.envrc b/templates/python/.envrc new file mode 100644 index 0000000..2f707c9 --- /dev/null +++ b/templates/python/.envrc @@ -0,0 +1 @@ +use flake . --no-use-registries diff --git a/templates/python/.gitignore b/templates/python/.gitignore new file mode 100644 index 0000000..21adfa8 --- /dev/null +++ b/templates/python/.gitignore @@ -0,0 +1,4 @@ +.direnv +result +*.pyc +.DS_Store diff --git a/templates/python/flake.lock b/templates/python/flake.lock new file mode 100644 index 0000000..b5fc821 --- /dev/null +++ b/templates/python/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1655779787, + "narHash": "sha256-Z5VL2AANN3Rk92xFs/3pPVyDQVTIcmNAIeTQNFOJnNE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ce83dc760cd3428ce9938aa711a0c7c81f55c567", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/templates/python/flake.nix b/templates/python/flake.nix new file mode 100644 index 0000000..012ca6f --- /dev/null +++ b/templates/python/flake.nix @@ -0,0 +1,20 @@ +{ + description = "Python pip flake"; + + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + pythonEnv = pkgs.python310.withPackages (pypi: + with pypi; + [ + # Add requirements here + requests + ]); + in { + devShells.default = pkgs.mkShell { buildInputs = [ pythonEnv ]; }; + }); +}