Update python venv template to be more robust

Move template into python39 folder in case I add more in the future
This commit is contained in:
Evie Litherland-Smith 2023-05-18 09:36:17 +01:00
parent 3a282dbee5
commit 1805e26cc1
2 changed files with 8 additions and 12 deletions

View file

@ -0,0 +1,8 @@
{pkgs ? import <nixpkgs> {}, ...}:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [python39 poetry git];
shellHook = ''
[ -e .venv/bin/python3 ] && VENV_FLAG="--upgrade" || VENV_FLAG="--clear"; python3 -m venv $VENV_FLAG .venv
[ -e .venv/bin/activate ] && source .venv/bin/activate
'';
}

View file

@ -1,12 +0,0 @@
{
pkgs ? import <nixpkgs> {},
python ? pkgs.python39,
...
}:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [(python.withPackages (ps: with ps; [pip wheel])) poetry git];
shellHook = ''
[ -d .venv ] || python -m venv .venv
source .venv/bin/activate
'';
}