From 3026703280158319205fad19b9d69a4e1c693780 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Thu, 6 Nov 2025 19:31:37 +0800 Subject: [PATCH] lib.extendMkDerivation: add argument excludeFunctionArgNames --- lib/customisation.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/customisation.nix b/lib/customisation.nix index 77875d91d38f..6159ce8ea27a 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -770,6 +770,10 @@ rec { : Argument names not to pass from the input fixed-point arguments to `constructDrv`. It doesn't apply to the updating arguments returned by `extendDrvArgs`. + `excludeFunctionArgNames` (default to `[ ]`) + : `__functionArgs` attribute names to remove from the result build helper. + `excludeFunctionArgNames` is useful for argument deprecation while avoiding ellipses. + `extendDrvArgs` (required) : An extension (overlay) of the argument set, like the one taken by [overrideAttrs](#sec-pkg-overrideAttrs) but applied before passing to `constructDrv`. @@ -787,6 +791,7 @@ rec { { constructDrv :: ((FixedPointArgs | AttrSet) -> a) excludeDrvArgNames :: [ String ], + excludeFunctionArgNames :: [ String ] extendDrvArgs :: (AttrSet -> AttrSet -> AttrSet) inheritFunctionArgs :: Bool, transformDrv :: a -> a, @@ -847,6 +852,7 @@ rec { { constructDrv, excludeDrvArgNames ? [ ], + excludeFunctionArgNames ? [ ], extendDrvArgs, inheritFunctionArgs ? true, transformDrv ? id, @@ -861,10 +867,12 @@ rec { ) # Add __functionArgs ( - # Inherit the __functionArgs from the base build helper - optionalAttrs inheritFunctionArgs (removeAttrs (functionArgs constructDrv) excludeDrvArgNames) - # Recover the __functionArgs from the derived build helper - // functionArgs (extendDrvArgs { }) + removeAttrs ( + # Inherit the __functionArgs from the base build helper + optionalAttrs inheritFunctionArgs (removeAttrs (functionArgs constructDrv) excludeDrvArgNames) + # Recover the __functionArgs from the derived build helper + // functionArgs (extendDrvArgs { }) + ) excludeFunctionArgNames ) // { inherit