Move robust library setting for python venv template, poetry template uses poetry2nix environment

This commit is contained in:
Evie Litherland-Smith 2023-04-19 11:52:47 +01:00
parent 277413469f
commit bd508ad4e1
3 changed files with 12 additions and 45 deletions

View file

@ -1,20 +1,10 @@
{ pkgs ? import <nixpkgs> {}, ... }:
pkgs.mkShell {
packages = with pkgs; [
python39
(poetry.override { python3 = python39; })
git
zlib
libgccjit
glibc
glibc_multi
];
shellHook = ''
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 ${pkgs.python39}/bin/python)"
[ -d "./.venv" ] && source .venv/bin/activate
'';
}
{ pkgs ? import <nixpkgs> { } }:
let
myAppEnv = pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
editablePackageSources = {
my-app = ./src;
};
};
in
myAppEnv.env

View file

@ -1,21 +0,0 @@
{ 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
zlib
libgccjit
];
shellHook = ''
export LD_LIBRARY_PATH="${pkgs.zlib}/lib:${pkgs.libgccjit}/lib"
'';
}

View file

@ -11,12 +11,10 @@ pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(python.withPackages python-packages)
git
zlib
libgccjit
];
shellHook = ''
export LD_LIBRARY_PATH="${pkgs.zlib}/lib:${pkgs.libgccjit}/lib"
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