diff --git a/default.nix b/default.nix new file mode 100644 index 00000000..934de9d2 --- /dev/null +++ b/default.nix @@ -0,0 +1,38 @@ +with (import {}); +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 + ''; +} diff --git a/develop_headless.nix b/develop_headless.nix new file mode 100644 index 00000000..934de9d2 --- /dev/null +++ b/develop_headless.nix @@ -0,0 +1,38 @@ +with (import {}); +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 + ''; +}