Loading lib/customisation.nix +4 −3 Original line number Diff line number Diff line Loading @@ -69,8 +69,8 @@ rec { "<pkg>.overrideDerivation" to learn about `overrideDerivation` and caveats related to its use. */ makeOverridable = f: origArgs: let makeOverridable = f: lib.setFunctionArgs (origArgs: let result = f origArgs; # Creates a functor with the same arguments as f Loading @@ -95,7 +95,8 @@ rec { lib.setFunctionArgs result (lib.functionArgs result) // { override = overrideArgs; } else result; else result) (lib.functionArgs f); /* Call the package function in the file `fn` with the required Loading lib/tests/misc.nix +12 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,18 @@ in runTests { # CUSTOMIZATION testFunctionArgsMakeOverridable = { expr = functionArgs (makeOverridable ({ a, b, c ? null}: {})); expected = { a = false; b = false; c = true; }; }; testFunctionArgsMakeOverridableOverride = { expr = functionArgs (makeOverridable ({ a, b, c ? null }: {}) { a = 1; b = 2; }).override; expected = { a = false; b = false; c = true; }; }; # TRIVIAL testId = { Loading Loading
lib/customisation.nix +4 −3 Original line number Diff line number Diff line Loading @@ -69,8 +69,8 @@ rec { "<pkg>.overrideDerivation" to learn about `overrideDerivation` and caveats related to its use. */ makeOverridable = f: origArgs: let makeOverridable = f: lib.setFunctionArgs (origArgs: let result = f origArgs; # Creates a functor with the same arguments as f Loading @@ -95,7 +95,8 @@ rec { lib.setFunctionArgs result (lib.functionArgs result) // { override = overrideArgs; } else result; else result) (lib.functionArgs f); /* Call the package function in the file `fn` with the required Loading
lib/tests/misc.nix +12 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,18 @@ in runTests { # CUSTOMIZATION testFunctionArgsMakeOverridable = { expr = functionArgs (makeOverridable ({ a, b, c ? null}: {})); expected = { a = false; b = false; c = true; }; }; testFunctionArgsMakeOverridableOverride = { expr = functionArgs (makeOverridable ({ a, b, c ? null }: {}) { a = 1; b = 2; }).override; expected = { a = false; b = false; c = true; }; }; # TRIVIAL testId = { Loading