From 193ab79228775f5e1a3f74b18427928fd2ceac5b Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Thu, 27 Mar 2025 11:09:41 +0100 Subject: [PATCH] initial commit --- .gitignore | 1 + flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 16 ++++++++++++++++ shell.nix | 28 ++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 shell.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..87a15c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.venv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..957dc1d --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1742889210, + "narHash": "sha256-hw63HnwnqU3ZQfsMclLhMvOezpM7RSB0dMAtD5/sOiw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "698214a32beb4f4c8e3942372c694f40848b360d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..61d2e26 --- /dev/null +++ b/flake.nix @@ -0,0 +1,16 @@ +{ + description = "kathara venv"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + systems.url = "github:nix-systems/default-linux"; + }; + + outputs = inputs: let + eachSystem = inputs.nixpkgs.lib.genAttrs (import inputs.systems); + pkgsFor = inputs.nixpkgs.legacyPackages; + in { + devShells = eachSystem (system: { + default = pkgsFor.${system}.callPackage ./shell.nix {}; + }); + }; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..07c89e2 --- /dev/null +++ b/shell.nix @@ -0,0 +1,28 @@ +{ + mkShell, + python3Packages, +}: let + inherit (python3Packages) python venvShellHook; +in + mkShell { + name = "impurePythonEnv"; + venvDir = "./.venv"; + buildInputs = [ + python + + venvShellHook + ]; + + # Run this command, only after creating the virtual environment + postVenvCreation = '' + unset SOURCE_DATE_EPOCH + pip install kathara + ''; + + # Now we can execute any commands within the virtual environment. + # This is optional and can be left out to run pip manually. + postShellHook = '' + # allow pip to install wheels + unset SOURCE_DATE_EPOCH + ''; + }