3
0
Fork 0
forked from mirrors/nixpkgs

modules: Enable setting extraArgs for all submodules or by name

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-06-04 17:47:42 -04:00
parent 6509d2cb2c
commit 888c7f2757

View file

@ -90,10 +90,17 @@ rec {
# Evaluate sub-modules. # Evaluate sub-modules.
subModuleMerge = path: vals: subModuleMerge = path: vals:
lib.fix (args: lib.fix (args:
let result = recurseInto path (optionConfig vals args); in { let
inherit (result) config options; result = recurseInto path (optionConfig vals args);
name = lib.removePrefix (opt.name + ".") path; name = lib.removePrefix (opt.name + ".") path;
} extraArgs = opt.extraArgs or {};
individualExtraArgs = opt.individualExtraArgs or {};
in {
inherit (result) config options;
inherit name;
} //
(opt.extraArgs or {}) //
(if hasAttr name individualExtraArgs then getAttr name individualExtraArgs else {})
); );
# Add _options in sub-modules to make it viewable from other # Add _options in sub-modules to make it viewable from other