nixos/templates/poetry.nix

28 lines
596 B
Nix
Raw Normal View History

2023-04-04 17:37:38 +01:00
{ pkgs ? import <nixpkgs> {}, python ? pkgs.python3, ... }:
let
python-packages = ps: with ps; [
pip
setuptools
wheel
];
in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(python.withPackages python-packages)
poetry
git
zlib
libgccjit
2023-04-04 17:37:38 +01:00
glibc
glibc_multi
];
shellHook = ''
2023-04-04 17:37:38 +01:00
export LD_LIBRARY_PATH="${pkgs.glibc}/lib:${pkgs.glibc_multi}/lib:${pkgs.zlib}/lib:${pkgs.libgccjit}/lib"
[ ! -f "pyproject.toml" ] && poetry init -n
poetry env use "$(command -v ${python}/bin/python)"
2023-04-04 17:37:38 +01:00
[ -d "./.venv" ] && source .venv/bin/activate
'';
}