add nix python environment

This commit is contained in:
Denis Lehmann 2020-04-13 16:15:27 +02:00
parent e420742a41
commit 0ce87451de
2 changed files with 23 additions and 0 deletions

20
default.nix Normal file
View file

@ -0,0 +1,20 @@
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "myPythonEnv";
buildInputs = with pkgs; [
python37Full
python37Packages.virtualenv
];
src = null;
shellHook = ''
if [ ! -d .venv ]; then
python -m venv .venv
fi
source .venv/bin/activate
pip install --upgrade pip
if [ -s requirements.txt ]; then
pip install -r requirements.txt
fi
'';
}