piker/default.nix

39 lines
824 B
Nix

with (import <nixpkgs> {});
with python311Packages;
let
glibStorePath = lib.getLib glib;
in
stdenv.mkDerivation {
name = "piker-poetry-shell-with-qt6";
buildInputs = [
# System libraries
libgcc.lib
glib
# Python requirements.
python311Full
poetry-core
];
src = null;
shellHook = ''
set -e
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${libgcc.lib}/lib:${glibStorePath}/lib
# Maybe create venv & install deps
poetry install
# Use pyqt6 from System, patch activate script
ACTIVATE_SCRIPT_PATH="$(poetry env info --path)/bin/activate"
if grep -q "$PATCH" "$ACTIVATE_SCRIPT_PATH"; then
echo "venv is already patched."
else
echo "patching $ACTIVATE_SCRIPT_PATH"
echo "$PATCH" >> "$ACTIVATE_SCRIPT_PATH"
fi
poetry shell
'';
}