nixos/templates/python39/shell.nix

10 lines
377 B
Nix
Raw Normal View History

{pkgs ? import <nixpkgs> {}, ...}:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [python39 poetry git];
shellHook = ''
2023-05-22 09:54:50 +01:00
export PROJECT_NAME=$(basename $(readlink -f .))
[ -e .venv/bin/python3 ] && VENV_FLAG="--upgrade" || VENV_FLAG="--clear"; python3 -m venv --prompt $PROJECT_NAME $VENV_FLAG .venv
[ -e .venv/bin/activate ] && source .venv/bin/activate
'';
}