nixos/templates/venv.nix

24 lines
581 B
Nix

{ pkgs ? import <nixpkgs> { }, python ? pkgs.python39, ... }:
let
python-packages = ps: with ps; [
pip
setuptools
wheel
];
in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(python.withPackages python-packages)
git
];
shellHook = ''
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/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
[ -f poetry.lock ] && python -m pip install -U poetry && python -m poetry install
'';
}