lib.extendMkDerivation: add argument excludeFunctionArgNames

This commit is contained in:
Yueh-Shun Li
2025-11-06 19:31:37 +08:00
parent d75b203514
commit 3026703280

View File

@@ -770,6 +770,10 @@ rec {
: Argument names not to pass from the input fixed-point arguments to `constructDrv`. : Argument names not to pass from the input fixed-point arguments to `constructDrv`.
It doesn't apply to the updating arguments returned by `extendDrvArgs`. 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) `extendDrvArgs` (required)
: An extension (overlay) of the argument set, like the one taken by [overrideAttrs](#sec-pkg-overrideAttrs) but applied before passing to `constructDrv`. : 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) constructDrv :: ((FixedPointArgs | AttrSet) -> a)
excludeDrvArgNames :: [ String ], excludeDrvArgNames :: [ String ],
excludeFunctionArgNames :: [ String ]
extendDrvArgs :: (AttrSet -> AttrSet -> AttrSet) extendDrvArgs :: (AttrSet -> AttrSet -> AttrSet)
inheritFunctionArgs :: Bool, inheritFunctionArgs :: Bool,
transformDrv :: a -> a, transformDrv :: a -> a,
@@ -847,6 +852,7 @@ rec {
{ {
constructDrv, constructDrv,
excludeDrvArgNames ? [ ], excludeDrvArgNames ? [ ],
excludeFunctionArgNames ? [ ],
extendDrvArgs, extendDrvArgs,
inheritFunctionArgs ? true, inheritFunctionArgs ? true,
transformDrv ? id, transformDrv ? id,
@@ -861,10 +867,12 @@ rec {
) )
# Add __functionArgs # Add __functionArgs
( (
removeAttrs (
# Inherit the __functionArgs from the base build helper # Inherit the __functionArgs from the base build helper
optionalAttrs inheritFunctionArgs (removeAttrs (functionArgs constructDrv) excludeDrvArgNames) optionalAttrs inheritFunctionArgs (removeAttrs (functionArgs constructDrv) excludeDrvArgNames)
# Recover the __functionArgs from the derived build helper # Recover the __functionArgs from the derived build helper
// functionArgs (extendDrvArgs { }) // functionArgs (extendDrvArgs { })
) excludeFunctionArgNames
) )
// { // {
inherit inherit