From 0969c6624713e3a3093bc586d5997ef93509ee76 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Fri, 24 Jan 2025 18:35:39 +0800 Subject: [PATCH] buildPython*: support fixed-point arguments via lib.extendMkDerivation Postpone formatting to minimize diff and to ease merging. --- .../python/mk-python-derivation.nix | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index 4092c64ba713..1c5eddd453e4 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -99,7 +99,12 @@ let "wheel" ]; - cleanAttrs = flip removeAttrs [ +in + +lib.extendMkDerivation { + constructDrv = stdenv.mkDerivation; + + excludeDrvArgNames = [ "disabled" "checkPhase" "checkInputs" @@ -114,8 +119,8 @@ let "build-system" ]; -in - + extendDrvArgs = + finalAttrs: { # Build-time dependencies for the package nativeBuildInputs ? [ ], @@ -197,10 +202,6 @@ in ... }@attrs: -let - # Keep extra attributes from `attrs`, e.g., `patchPhase', etc. - self = stdenv.mkDerivation ( - finalAttrs: let getFinalPassthru = let @@ -283,8 +284,7 @@ let name = namePrefix + attrs.name or "${finalAttrs.pname}-${finalAttrs.version}"; in - (cleanAttrs attrs) - // { + { inherit name; inherit catchConflicts; @@ -448,7 +448,7 @@ let "enabledTests" ] attrs ) - ); + ; # This derivation transformation function must be independent to `attrs` # for fixed-point arguments support in the future. @@ -468,6 +468,4 @@ let }; in drv: disablePythonPackage (toPythonModule drv); - -in -transformDrv self +}