From d89172980b5f25924e165c1046d6f0a995b14730 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Thu, 18 Dec 2025 12:20:02 +0100 Subject: [PATCH 1/4] wrapPythonPrograms: support structuredAttrs $pythonPath can be an array - if we don't expand it we only get the first element. --- pkgs/development/interpreters/python/wrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/wrap.sh b/pkgs/development/interpreters/python/wrap.sh index f10ba003432b..c4f9270fa202 100644 --- a/pkgs/development/interpreters/python/wrap.sh +++ b/pkgs/development/interpreters/python/wrap.sh @@ -1,7 +1,7 @@ # Wrapper around wrapPythonProgramsIn, below. The $pythonPath # variable is passed in from the buildPythonPackage function. wrapPythonPrograms() { - wrapPythonProgramsIn "$out/bin" "$out $pythonPath" + wrapPythonProgramsIn "$out/bin" "$out ${pythonPath[*]}" } # Builds environment variables like PYTHONPATH and PATH walking through closure From 6437d6009d9c90211ec5a832bda557a1c8e273db Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Thu, 18 Dec 2025 12:21:19 +0100 Subject: [PATCH 2/4] gi-docgen: add versionCheckHook to test wrapPythonPrograms fix --- pkgs/by-name/gi/gi-docgen/package.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/gi/gi-docgen/package.nix b/pkgs/by-name/gi/gi-docgen/package.nix index 6608c40baa23..e2b2aa033e8d 100644 --- a/pkgs/by-name/gi/gi-docgen/package.nix +++ b/pkgs/by-name/gi/gi-docgen/package.nix @@ -5,6 +5,7 @@ ninja, python3, gnome, + versionCheckHook, }: python3.pkgs.buildPythonApplication rec { @@ -36,12 +37,17 @@ python3.pkgs.buildPythonApplication rec { typogrify ]; - doCheck = false; # no tests + # For Python this must be placed in nativeCheckInputs instead of nativeInstallCheckInputs + # https://github.com/nixos/nixpkgs/issues/420531 + nativeCheckInputs = [ versionCheckHook ]; + # doCheck = false; # no tests - restore this after versionCheckHook can be moved + + __structuredAttrs = true; postFixup = '' # Do not propagate Python substituteInPlace $out/nix-support/propagated-build-inputs \ - --replace "${python3}" "" + --replace-fail "${python3}" "" ''; passthru = { From d92f45d1bb1fa8b3b5a18bd70733bfefe5a86174 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Thu, 18 Dec 2025 12:21:52 +0100 Subject: [PATCH 3/4] freecell-solver: extend install check to test wrapPythonPrograms fix --- pkgs/by-name/fr/freecell-solver/package.nix | 24 +++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/fr/freecell-solver/package.nix b/pkgs/by-name/fr/freecell-solver/package.nix index 8c962bbb5155..e562bb9597ef 100644 --- a/pkgs/by-name/fr/freecell-solver/package.nix +++ b/pkgs/by-name/fr/freecell-solver/package.nix @@ -11,6 +11,7 @@ pkg-config, python3, rinutils, + versionCheckHook, }: stdenv.mkDerivation (finalAttrs: { @@ -74,10 +75,29 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeBool "BUILD_STATIC_LIBRARY" false) ]; - postFixup = '' - wrapPythonProgramsIn "$out/bin" "$out $pythonPath" + preFixup = '' + # This is a module and should not be wrapped, or it causes import errors + # on the scripts that are actually executable + chmod a-x $out/bin/fc_solve_find_index_s2ints.py ''; + postFixup = '' + wrapPythonProgramsIn "$out/bin" "$out ''${pythonPath[*]}" + ''; + + nativeInstallCheckInputs = [ versionCheckHook ]; + postInstallCheck = '' + # Check that the python wrappers work correctly: + # * fc_solve_find_index_s2ints.py should be unwrapped (we get SyntaxError otherwise) + # * the wrapper should provide all modules from the pythonPath (we get ModuleNotFoundError otherwise) + # * we don't provide valid input so expect IndexError + unset PYTHONPATH + ($out/bin/make_pysol_freecell_board.py 2>&1 | tee /dev/stderr || true) | grep -q "IndexError:" + ''; + doInstallCheck = true; + + __structuredAttrs = true; + meta = { homepage = "https://fc-solve.shlomifish.org/"; description = "FreeCell automatic solver"; From 4edffc2e46877d2adfdcde5065149d6d752d003d Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Thu, 18 Dec 2025 12:22:04 +0100 Subject: [PATCH 4/4] freecell-solver: 6.14.0 -> 6.16.0 --- pkgs/by-name/fr/freecell-solver/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/fr/freecell-solver/package.nix b/pkgs/by-name/fr/freecell-solver/package.nix index e562bb9597ef..5e271ff8a57d 100644 --- a/pkgs/by-name/fr/freecell-solver/package.nix +++ b/pkgs/by-name/fr/freecell-solver/package.nix @@ -16,11 +16,11 @@ stdenv.mkDerivation (finalAttrs: { pname = "freecell-solver"; - version = "6.14.0"; + version = "6.16.0"; src = fetchurl { url = "https://fc-solve.shlomifish.org/downloads/fc-solve/freecell-solver-${finalAttrs.version}.tar.xz"; - hash = "sha256-HREl2FQivNUhEC18sefIS3aGP+RF3SGHn5d53Gss59w="; + hash = "sha256-cbiILmjxvmJSkGkBjQxzK3UHhmkHfJY0gnlXWEnzQxM="; }; outputs = [