From df08ddf5bf1c2ca1cca592189ab60e679e2bfdf9 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 4 Apr 2023 09:48:40 +0100 Subject: [PATCH] Add separate python venv template --- templates/python.nix | 3 --- templates/venv.nix | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 templates/venv.nix diff --git a/templates/python.nix b/templates/python.nix index dfe1bb76..5053d2f5 100644 --- a/templates/python.nix +++ b/templates/python.nix @@ -17,8 +17,5 @@ pkgs.mkShell { shellHook = '' export LD_LIBRARY_PATH="${pkgs.zlib}/lib:${pkgs.libgccjit}/lib" - python -m venv .venv - source .venv/bin/activate - pip list --outdated | grep -iE "^(pip|wheel)" > /dev/null && python -m pip install --upgrade pip wheel ''; } diff --git a/templates/venv.nix b/templates/venv.nix new file mode 100644 index 00000000..dfe1bb76 --- /dev/null +++ b/templates/venv.nix @@ -0,0 +1,24 @@ +{ pkgs ? import {}, python ? pkgs.python39, ... }: + +let + python-packages = ps: with ps; [ + pip + setuptools + wheel + ]; +in +pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + (python.withPackages python-packages) + git + zlib + libgccjit + ]; + + shellHook = '' + export LD_LIBRARY_PATH="${pkgs.zlib}/lib:${pkgs.libgccjit}/lib" + python -m venv .venv + source .venv/bin/activate + pip list --outdated | grep -iE "^(pip|wheel)" > /dev/null && python -m pip install --upgrade pip wheel + ''; +}