Extract the path done inside the iteration process of the option type and

give it as argument to each sub-module.

With the type "types.attrsOf types.optionSet", you will obtain the name of
the attribute in which the sub-modules are contained.

svn path=/nixpkgs/trunk/; revision=17669
This commit is contained in:
Nicolas Pierron 2009-10-06 09:21:46 +00:00
parent 1f68748a8b
commit bbb4ce1dd7

View file

@ -83,16 +83,17 @@ rec {
if opt ? type && opt.type.hasOptions then
let
optionConfig = opts: config:
map (f: lib.applyIfFunction f config)
(opt.options ++ toList opts);
optionConfig = vals: path: config:
let name = lib.removePrefix (opt.name + ".") path; in
map (f: lib.applyIfFunction f ({inherit name;} // config))
(opt.options ++ toList vals);
in
opt // {
merge = list:
opt.type.iter
(path: opts:
(path: vals:
(lib.fix
(fixableMergeFun (recurseInto path) (optionConfig opts))
(fixableMergeFun (recurseInto path) (optionConfig vals path))
).config
)
opt.name
@ -100,7 +101,7 @@ rec {
options =
let path = opt.type.docPath opt.name; in
(lib.fix
(fixableMergeFun (recurseInto path) (optionConfig []))
(fixableMergeFun (recurseInto path) (optionConfig [] path))
).options;
}
else