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 ? import <nixpkgs> { } }:
let
pkgs.mkShell { myAppEnv = pkgs.poetry2nix.mkPoetryEnv {
packages = with pkgs; [ projectDir = ./.;
python39 editablePackageSources = {
(poetry.override { python3 = python39; }) my-app = ./src;
git };
zlib };
libgccjit in
glibc myAppEnv.env
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
'';
}

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

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> {}, python ? pkgs.python39, ... }: { pkgs ? import <nixpkgs> { }, python ? pkgs.python39, ... }:
let let
python-packages = ps: with ps; [ python-packages = ps: with ps; [
@ -11,12 +11,10 @@ pkgs.mkShell {
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
(python.withPackages python-packages) (python.withPackages python-packages)
git git
zlib
libgccjit
]; ];
shellHook = '' 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 python -m venv .venv
source .venv/bin/activate source .venv/bin/activate
pip list --outdated | grep -iE "^(pip|wheel)" > /dev/null && python -m pip install --upgrade pip wheel pip list --outdated | grep -iE "^(pip|wheel)" > /dev/null && python -m pip install --upgrade pip wheel