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: ${if ff ? overrideAttrs then "overrideAttrs" else null} = fdrv:
overrideResult (x: x.overrideAttrs fdrv); overrideResult (x: x.overrideAttrs fdrv);
}) })
else if lib.isFunction ff then { else if lib.isFunction ff then
override = overrideArgs; # Transform ff into a functor while propagating its arguments
__functor = self: ff; lib.setFunctionArgs ff (lib.functionArgs ff) // {
overrideDerivation = throw "overrideDerivation not yet supported for functors"; override = overrideArgs;
} overrideDerivation = throw "overrideDerivation not yet supported for functors";
}
else ff; else ff;