From 888c7f27578a1d025c3f28e23d7c767bb3b509a3 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 4 Jun 2013 17:47:42 -0400 Subject: [PATCH] modules: Enable setting extraArgs for all submodules or by name Signed-off-by: Shea Levy --- pkgs/lib/options.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix index 59bda41a623f..4e9390470709 100644 --- a/pkgs/lib/options.nix +++ b/pkgs/lib/options.nix @@ -90,10 +90,17 @@ rec { # Evaluate sub-modules. subModuleMerge = path: vals: lib.fix (args: - let result = recurseInto path (optionConfig vals args); in { - inherit (result) config options; + let + result = recurseInto path (optionConfig vals args); 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