From ce3dc05a4c188e457721d8972b364e11ab71a64e Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Mon, 11 May 2026 20:35:44 -0400 Subject: [PATCH 1/4] buildPythonPackage: save a function call --- pkgs/development/interpreters/python/mk-python-derivation.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index 5f4ac7b84645..6746e4b1ec63 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -271,7 +271,7 @@ lib.extendMkDerivation { if (isPythonModule drv) && (isMismatchedPython drv) then throwMismatch attrName drv else drv; in - attrName: inputs: map (checkDrv attrName) inputs; + attrName: map (checkDrv attrName); isBootstrapInstallPackage = isBootstrapInstallPackage' (finalAttrs.pname or null); From b57eb40ea7694d823e3e12b0791090ac0e4256ca Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Mon, 11 May 2026 20:37:46 -0400 Subject: [PATCH 2/4] buildPythonPackage: avoid validating python itself --- .../interpreters/python/mk-python-derivation.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index 6746e4b1ec63..7155137b1f2f 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -373,16 +373,16 @@ lib.extendMkDerivation { buildInputs = validatePythonMatches "buildInputs" (buildInputs ++ pythonPath); - propagatedBuildInputs = validatePythonMatches "propagatedBuildInputs" ( - propagatedBuildInputs - ++ getFinalPassthru "dependencies" + propagatedBuildInputs = + validatePythonMatches "propagatedBuildInputs" ( + propagatedBuildInputs ++ getFinalPassthru "dependencies" + ) ++ [ # we propagate python even for packages transformed with 'toPythonApplication' # this pollutes the PATH but avoids rebuilds # see https://github.com/NixOS/nixpkgs/issues/170887 for more context python - ] - ); + ]; inherit strictDeps; From 0f027769b28494e49dc08e47a1707b45889038a0 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Mon, 11 May 2026 20:41:53 -0400 Subject: [PATCH 3/4] buildPythonPackage: use nullable attr keys instead --- .../python/mk-python-derivation.nix | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index 7155137b1f2f..6dd3651bfa30 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -40,7 +40,6 @@ let flip getName hasSuffix - head isBool max optional @@ -48,13 +47,9 @@ let optionals optionalString removePrefix - splitString stringLength ; - getOptionalAttrs = - names: attrs: lib.getAttrs (lib.intersectLists names (lib.attrNames attrs)) attrs; - leftPadName = name: against: let @@ -463,13 +458,11 @@ lib.extendMkDerivation { attrs.${name} == [ ] ) "${lib.getName finalAttrs}: ${name} must be unspecified, null or a non-empty list." attrs.${name} ) - ( - getOptionalAttrs [ - "enabledTestMarks" - "enabledTestPaths" - "enabledTests" - ] attrs - ); + { + ${if attrs ? enabledTestMarks then "enabledTestMarks" else null} = attrs.enabledTestMarks; + ${if attrs ? enabledTestPaths then "enabledTestPaths" else null} = attrs.enabledTestPaths; + ${if attrs ? enabledTests then "enabledTests" else null} = attrs.enabledTests; + }; # This derivation transformation function must be independent to `attrs` # for fixed-point arguments support in the future. From bc3ca125ebebc7ba622faede612b676cca4d3907 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Mon, 11 May 2026 20:47:17 -0400 Subject: [PATCH 4/4] python/wrapper: use the python that's already added requiredPythonModules always adds a python element. --- pkgs/development/interpreters/python/wrapper.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/wrapper.nix b/pkgs/development/interpreters/python/wrapper.nix index 914e4b354c49..2f901232c1ec 100644 --- a/pkgs/development/interpreters/python/wrapper.nix +++ b/pkgs/development/interpreters/python/wrapper.nix @@ -23,7 +23,7 @@ let env = let - paths = requiredPythonModules (extraLibs ++ [ python ]) ++ [ + paths = requiredPythonModules extraLibs ++ [ (runCommand "bin" { } '' mkdir -p $out/bin '')