Add setFunctionArgs lib function.

Among other things, this will allow *2nix tools to output plain data
while still being composable with the traditional
callPackage/.override interfaces.
This commit is contained in:
Shea Levy
2018-01-31 14:02:19 -05:00
parent 0d7a0d7572
commit 943592f698
18 changed files with 60 additions and 33 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ rec {
*/
callPackageWith = autoArgs: fn: args:
let
f = if builtins.isFunction fn then fn else import fn;
auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
f = if pkgs.lib.isFunction fn then fn else import fn;
auto = builtins.intersectAttrs (stdenv.lib.functionArgs f) autoArgs;
in f (auto // args);
callPackage = callPackageWith pkgs;