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:
parent
3a282dbee5
commit
1805e26cc1
8
templates/python39/shell.nix
Normal file
8
templates/python39/shell.nix
Normal 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
|
||||||
|
'';
|
||||||
|
}
|
|
@ -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
|
|
||||||
'';
|
|
||||||
}
|
|
Loading…
Reference in a new issue