From c638dac226e1b3f86fee155d9a27839e3fb4b7e5 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Thu, 5 Sep 2019 00:14:22 +0200 Subject: [PATCH] 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; ... } --- lib/customisation.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/customisation.nix b/lib/customisation.nix index 09d7fbf74b0..c4eeee9a045 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;