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; ... }
This commit is contained in:
Silvan Mosberger 2019-09-05 00:14:22 +02:00
parent d54bdf5504
commit c638dac226
No known key found for this signature in database
GPG Key ID: 9424360B4B85C9E7

View File

@ -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;