diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-03-12 10:16:58 -0500 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-03-12 10:16:58 -0500 |
| commit | 0b669f348301d5c02f29a91aa4ded2c9cb904974 (patch) | |
| tree | 02f4fd1a9d7cee921e2e9d76904af60ef2906f06 /nix | |
| parent | c3934b138c8e9b953de5fe11dfb171396bc2ad90 (diff) | |
Fix NixOS CI: use nix python for cmake, venv only for pybind11 pin
FindPython needs the real nix Python (with dev headers), not the venv
wrapper. Save NIX_PYTHON3 before venv overrides PATH. Tested locally.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/mobase-shell.nix | 126 |
1 files changed, 65 insertions, 61 deletions
diff --git a/nix/mobase-shell.nix b/nix/mobase-shell.nix index c39dd02..ae5ad91 100644 --- a/nix/mobase-shell.nix +++ b/nix/mobase-shell.nix @@ -1,61 +1,65 @@ -{ pkgs ? import <nixpkgs> {} }:
-
-let
- python = pkgs.python313;
- pythonWithPkgs = python.withPackages (ps: [
- ps.sip
- ps.pyqt6
- ]);
-in
-pkgs.mkShell {
- nativeBuildInputs = with pkgs; [
- cmake
- ninja
- pkg-config
- git
- rustc
- cargo
- ];
-
- buildInputs = with pkgs; [
- # Qt 6
- qt6.qtbase
- qt6.wrapQtAppsHook
- qt6.qtwebengine
- qt6.qtwebsockets
- qt6.qtsvg
- qt6.qtwayland
-
- # Python
- pythonWithPkgs
-
- # Libraries
- boost
- sqlite
- tinyxml-2
- fontconfig
- spdlog
- fuse3
- libcap
- lz4
- zlib
- zstd
- bzip2
- xz
- openssl
- curl
- tomlplusplus
- fmt
- ];
-
- shellHook = ''
- # 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"
- '';
-}
+{ pkgs ? import <nixpkgs> {} }: + +let + python = pkgs.python313; + pythonWithPkgs = python.withPackages (ps: [ + ps.sip + ps.pyqt6 + ]); +in +pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + cmake + ninja + pkg-config + git + rustc + cargo + ]; + + buildInputs = with pkgs; [ + # Qt 6 + qt6.qtbase + qt6.wrapQtAppsHook + qt6.qtwebengine + qt6.qtwebsockets + qt6.qtsvg + qt6.qtwayland + + # Python (withPackages for runtime, base python313 for dev headers/libpython) + pythonWithPkgs + python313 + + # Libraries + boost + sqlite + tinyxml-2 + fontconfig + spdlog + fuse3 + libcap + lz4 + zlib + zstd + bzip2 + xz + openssl + curl + tomlplusplus + fmt + ]; + + shellHook = '' + # Save the real nix Python before venv overrides PATH (cmake needs this) + export NIX_PYTHON3="$(command -v python3)" + + # 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" + ''; +} |
