Compare commits

...

3 Commits

4 changed files with 878 additions and 441 deletions

74
default.nix 100644
View File

@ -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
'';
}

View File

@ -1,47 +0,0 @@
with (import <nixpkgs> {});
stdenv.mkDerivation {
name = "poetry-env";
buildInputs = [
# System requirements.
readline
# TODO: hacky non-poetry install stuff we need to get rid of!!
poetry
# virtualenv
# setuptools
# pip
# Python requirements (enough to get a virtualenv going).
python311Full
# obviously, and see below for hacked linking
python311Packages.pyqt5
python311Packages.pyqt5_sip
# python311Packages.qtpy
# numerics deps
python311Packages.levenshtein
python311Packages.fastparquet
python311Packages.polars
];
# environment.sessionVariables = {
# LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
# };
src = null;
shellHook = ''
# Allow the use of wheels.
SOURCE_DATE_EPOCH=$(date +%s)
# 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";
if [ ! -d ".venv" ]; then
poetry install --with uis
fi
poetry shell
'';
}

1182
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -91,7 +91,7 @@ develop = true
[tool.poetry.dependencies.tractor]
git = 'https://github.com/goodboy/tractor.git'
branch = 'asyncio_debugger_support'
branch = 'multihomed'
# branch = 'piker_pin'
develop = true
# path = '../tractor/'
@ -108,7 +108,19 @@ rapidfuzz = "^3.2.0"
qdarkstyle = ">=3.0.2"
pyqt5 = "^5.15.9"
pyqtgraph = { git = 'https://github.com/pikers/pyqtgraph.git' }
pyqt6 = "^6.5.2"
# pyqt6 = "^6.5.2"
# ------ - ------
# only diference with uis group is on nix we use some sys py packages
[tool.poetry.group.nix-shell]
optional = true
[tool.poetry.group.nix-shell.dependencies]
# rapidfuzz = "^3.2.0"
# qdarkstyle = ">=3.0.2"
# pyqt5 = "^5.15.9"
pyqtgraph = { git = 'https://github.com/pikers/pyqtgraph.git' }
# pyqt6 = "^6.5.2"
# ------ - ------