aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-03-12 10:09:07 -0500
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-03-12 10:09:07 -0500
commitc3934b138c8e9b953de5fe11dfb171396bc2ad90 (patch)
treeda148c26f740867542fb27e9ad30aabb032ae0ee /nix
parent776948aa785f946ea1498e656f4f9cd7638c5024 (diff)
Fix NixOS CI: use venv for pinned pybind11 (nix Python is immutable)
Nix Python environments can't be modified with pip directly. Create a temporary venv with --system-site-packages and install pybind11==2.13.6 into it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'nix')
-rw-r--r--nix/mobase-shell.nix23
1 files changed, 16 insertions, 7 deletions
diff --git a/nix/mobase-shell.nix b/nix/mobase-shell.nix
index c6b326e..c39dd02 100644
--- a/nix/mobase-shell.nix
+++ b/nix/mobase-shell.nix
@@ -1,5 +1,12 @@
{ pkgs ? import <nixpkgs> {} }:
+let
+ python = pkgs.python313;
+ pythonWithPkgs = python.withPackages (ps: [
+ ps.sip
+ ps.pyqt6
+ ]);
+in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cmake
@@ -19,11 +26,8 @@ pkgs.mkShell {
qt6.qtsvg
qt6.qtwayland
- # Python (pybind11 installed via pip in shellHook to pin version)
- python313
- python313Packages.pip
- python313Packages.sip
- python313Packages.pyqt6
+ # Python
+ pythonWithPkgs
# Libraries
boost
@@ -45,8 +49,13 @@ pkgs.mkShell {
];
shellHook = ''
- # Pin pybind11 to 2.13.6 (must match Docker build for ABI compat)
- pip install --quiet pybind11==2.13.6 2>/dev/null || true
+ # Create a temporary venv to install pinned pybind11 (nixpkgs version is too new)
+ if [ ! -d .nix-venv ]; then
+ python3 -m venv .nix-venv --system-site-packages
+ .nix-venv/bin/pip install --quiet pybind11==2.13.6
+ fi
+ export PATH="$PWD/.nix-venv/bin:$PATH"
+ export PYTHONPATH="$PWD/.nix-venv/lib/python3.13/site-packages:$PYTHONPATH"
export CMAKE_PREFIX_PATH="${pkgs.qt6.qtbase}:${pkgs.qt6.qtwebengine}:${pkgs.qt6.qtwebsockets}:${pkgs.qt6.qtsvg}:$CMAKE_PREFIX_PATH"
'';
}