-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor default.nix and add nix-shell specific group to dependecies
- Loading branch information
Showing
3 changed files
with
859 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,69 @@ | ||
with (import <nixpkgs> {}); | ||
|
||
with python311Packages; | ||
let | ||
rapidfuzzStorePath = lib.getLib rapidfuzz; | ||
qdarkstyleStorePath = lib.getLib qdarkstyle; | ||
pyqt5StorePath = lib.getLib pyqt5; | ||
pyqt5SipStorePath = lib.getLib pyqt5_sip; | ||
in | ||
stdenv.mkDerivation { | ||
name = "poetry-env"; | ||
name = "piker-poetry-shell-with-qt-fix"; | ||
buildInputs = [ | ||
# System requirements. | ||
readline | ||
|
||
# TODO: hacky non-poetry install stuff we need to get rid of!! | ||
poetry | ||
# virtualenv | ||
# setuptools | ||
# pip | ||
libsForQt5.qt5.qtbase | ||
|
||
# Python requirements (enough to get a virtualenv going). | ||
# Python requirements. | ||
python311Full | ||
|
||
# obviously, and see below for hacked linking | ||
python311Packages.pyqt5 | ||
python311Packages.pyqt5_sip | ||
# python311Packages.qtpy | ||
|
||
# numerics deps | ||
python311Packages.levenshtein | ||
python311Packages.fastparquet | ||
python311Packages.polars | ||
|
||
poetry-core | ||
rapidfuzz | ||
qdarkstyle | ||
pyqt5 | ||
]; | ||
# environment.sessionVariables = { | ||
# LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib"; | ||
# }; | ||
src = null; | ||
shellHook = '' | ||
# Allow the use of wheels. | ||
SOURCE_DATE_EPOCH=$(date +%s) | ||
set -e | ||
QTBASE_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}" | ||
# Augment the dynamic linker path | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${R}/lib/R/lib:${readline}/lib | ||
export QT_QPA_PLATFORM_PLUGIN_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins"; | ||
# Set the Qt plugin path | ||
# export QT_DEBUG_PLUGINS=1 | ||
export QT_PLUGIN_PATH="$QTBASE_PATH/plugins" | ||
export QT_QPA_PLATFORM_PLUGIN_PATH="$QT_PLUGIN_PATH/platforms" | ||
if [ ! -d ".venv" ]; then | ||
poetry install --with uis | ||
# Maybe create venv & install deps | ||
poetry install --with=nix-shell | ||
# Use pyqt5 from System, patch activate script | ||
ACTIVATE_SCRIPT_PATH="$(poetry env info --path)/bin/activate" | ||
export RPDFUZZ_PATH="${rapidfuzzStorePath}/lib/python3.11/site-packages" | ||
export QDRKSTYLE_PATH="${qdarkstyleStorePath}/lib/python3.11/site-packages" | ||
export PYQT5_PATH="${pyqt5StorePath}/lib/python3.11/site-packages" | ||
export PYQT5_SIP_PATH="${pyqt5SipStorePath}/lib/python3.11/site-packages" | ||
echo "rapidfuzz at: $RPDFUZZ_PATH" | ||
echo "qdarkstyle at: $QDRKSTYLE_PATH" | ||
echo "pyqt5 at: $PYQT5_PATH" | ||
echo "pyqt5-sip at: $PYQT5_SIP_PATH" | ||
echo "" | ||
PATCH="export PYTHONPATH=\"" | ||
PATCH="$PATCH\$RPDFUZZ_PATH" | ||
PATCH="$PATCH:\$QDRKSTYLE_PATH" | ||
PATCH="$PATCH:\$PYQT5_PATH" | ||
PATCH="$PATCH:\$PYQT5_SIP_PATH" | ||
PATCH="$PATCH\"" | ||
if grep -q "$PATCH" "$ACTIVATE_SCRIPT_PATH"; then | ||
echo "venv is already patched." | ||
else | ||
echo "patching $ACTIVATE_SCRIPT_PATH to use pyqt5 from nixos..." | ||
sed -i "\$i$PATCH" $ACTIVATE_SCRIPT_PATH | ||
fi | ||
echo "qt plguin path: $QT_PLUGIN_PATH" | ||
echo "" | ||
poetry shell | ||
''; | ||
} |
Oops, something went wrong.