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:
parent
1f68748a8b
commit
bbb4ce1dd7
@ -83,16 +83,17 @@ rec {
|
|||||||
if opt ? type && opt.type.hasOptions then
|
if opt ? type && opt.type.hasOptions then
|
||||||
let
|
let
|
||||||
|
|
||||||
optionConfig = opts: config:
|
optionConfig = vals: path: config:
|
||||||
map (f: lib.applyIfFunction f config)
|
let name = lib.removePrefix (opt.name + ".") path; in
|
||||||
(opt.options ++ toList opts);
|
map (f: lib.applyIfFunction f ({inherit name;} // config))
|
||||||
|
(opt.options ++ toList vals);
|
||||||
in
|
in
|
||||||
opt // {
|
opt // {
|
||||||
merge = list:
|
merge = list:
|
||||||
opt.type.iter
|
opt.type.iter
|
||||||
(path: opts:
|
(path: vals:
|
||||||
(lib.fix
|
(lib.fix
|
||||||
(fixableMergeFun (recurseInto path) (optionConfig opts))
|
(fixableMergeFun (recurseInto path) (optionConfig vals path))
|
||||||
).config
|
).config
|
||||||
)
|
)
|
||||||
opt.name
|
opt.name
|
||||||
@ -100,7 +101,7 @@ rec {
|
|||||||
options =
|
options =
|
||||||
let path = opt.type.docPath opt.name; in
|
let path = opt.type.docPath opt.name; in
|
||||||
(lib.fix
|
(lib.fix
|
||||||
(fixableMergeFun (recurseInto path) (optionConfig []))
|
(fixableMergeFun (recurseInto path) (optionConfig [] path))
|
||||||
).options;
|
).options;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user