aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml3
-rw-r--r--.gitignore4
-rw-r--r--nix/mobase-shell.nix126
3 files changed, 71 insertions, 62 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fd072f1..268a272 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -101,10 +101,11 @@ jobs:
cmake --install /tmp/libloot/build
# Configure full project (only mobase target will be built)
+ # Use NIX_PYTHON3 (real nix python) for cmake, not the venv wrapper
PYBIND11_DIR=\$(python3 -c 'import pybind11; print(pybind11.get_cmake_dir())')
cmake -S . -B build-nix -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
- -DPython_EXECUTABLE=\$(which python3) \
+ -DPython_EXECUTABLE=\"\${NIX_PYTHON3}\" \
-Dpybind11_DIR=\"\${PYBIND11_DIR}\" \
-DBUILD_PLUGIN_PYTHON=ON \
-DCMAKE_PREFIX_PATH=/tmp/libloot-install \
diff --git a/.gitignore b/.gitignore
index 96bb944..2e2bc91 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,3 +35,7 @@ __pycache__/
# Generated settings files
fomod-plus-settings.ini
+
+# Nix
+.nix-venv/
+result
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"
+ '';
+}