Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 'develop.nix' file #538

Open
wants to merge 3 commits into
base: distribute_dis
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
with (import <nixpkgs> {});
with python311Packages;
let
rapidfuzzStorePath = lib.getLib rapidfuzz;
qdarkstyleStorePath = lib.getLib qdarkstyle;
qtpyStorePath = lib.getLib qtpy;
pyqt5StorePath = lib.getLib pyqt5;
pyqt5SipStorePath = lib.getLib pyqt5_sip;
in
stdenv.mkDerivation {
name = "piker-poetry-shell-with-qt-fix";
buildInputs = [
# System requirements.
libsForQt5.qt5.qtbase

# Python requirements.
python311Full
poetry-core
rapidfuzz
qdarkstyle
qtpy
pyqt5
];
src = null;
shellHook = ''
set -e

QTBASE_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}"

# 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"

# 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 QTPY_PATH="${qtpyStorePath}/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 "qtpy at: $QTPY_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:\$QTPY_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
'';
}
47 changes: 0 additions & 47 deletions develop.nix

This file was deleted.

Loading
Loading