summaryrefslogtreecommitdiff
path: root/lib/customisation.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2019-09-05 00:14:22 +0200
committerSilvan Mosberger <infinisil@icloud.com>2019-09-05 00:57:04 +0200
commitc638dac226e1b3f86fee155d9a27839e3fb4b7e5 (patch)
tree5ccd233e984dcdbc0dfe32b8d29f5c1149ac2b60 /lib/customisation.nix
parentlib/makeOverridable: Propagate function arguments to override functions (diff)
downloadnixpkgs-c638dac226e1b3f86fee155d9a27839e3fb4b7e5.tar.gz
lib/makeOverridable: Propagate function args of the callPackage'd function
This allows querying function arguments of things like fetchFromGitHub: nix-repl> lib.functionArgs pkgs.fetchFromGitHub { fetchSubmodules = true; githubBase = true; ... }
Diffstat (limited to 'lib/customisation.nix')
-rw-r--r--lib/customisation.nix11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix
index 09d7fbf74b0f..c4eeee9a0456 100644
--- a/lib/customisation.nix
+++ b/lib/customisation.nix
@@ -82,11 +82,12 @@ rec {
${if ff ? overrideAttrs then "overrideAttrs" else null} = fdrv:
overrideResult (x: x.overrideAttrs fdrv);
})
- else if lib.isFunction ff then {
- override = overrideArgs;
- __functor = self: ff;
- overrideDerivation = throw "overrideDerivation not yet supported for functors";
- }
+ else if lib.isFunction ff then
+ # Transform ff into a functor while propagating its arguments
+ lib.setFunctionArgs ff (lib.functionArgs ff) // {
+ override = overrideArgs;
+ overrideDerivation = throw "overrideDerivation not yet supported for functors";
+ }
else ff;