* Do not always use the current result as argument.
* "filterOptionSets" returns the only option per attribute instead of a list of options. svn path=/nixpkgs/trunk/; revision=12520
This commit is contained in:
parent
7061a01749
commit
0ce4cafd88
@ -399,25 +399,27 @@ rec {
|
|||||||
name = if path == "" then attr else path + "." + attr;
|
name = if path == "" then attr else path + "." + attr;
|
||||||
test = partition isOption opts;
|
test = partition isOption opts;
|
||||||
in
|
in
|
||||||
if test.right == []
|
if test.right == [] then filterOptionSets name test.wrong
|
||||||
then filterOptionSets name test.wrong
|
else if tail test.right != [] then throw "Multiple options for '${name}'."
|
||||||
else map (x: x // { inherit name; }) test.right
|
else { inherit name; } // (head test.right)
|
||||||
) opts
|
) opts
|
||||||
else {};
|
else {};
|
||||||
|
|
||||||
# Evaluate a list of option sets that would be merged with the
|
# Evaluate a list of option sets that would be merged with the
|
||||||
# function "merge" which expects two arguments. The attribute named
|
# function "merge" which expects two arguments. The attribute named
|
||||||
# "require" is used to imports option declarations and bindings.
|
# "require" is used to imports option declarations and bindings.
|
||||||
finalReferenceOptionSets = merge: pkgs: opts:
|
finalOptionSetsFun = merge: pkgs: opts:
|
||||||
let optionSet = final: configFun:
|
let optionSet = final: configFun:
|
||||||
if __isFunction configFun then configFun pkgs final
|
if __isFunction configFun then configFun pkgs final
|
||||||
else configFun; # backward compatibility.
|
else configFun; # backward compatibility.
|
||||||
in
|
in
|
||||||
finalReference (final: merge ""
|
final: merge ""
|
||||||
(map (x: removeAttrs x ["require"])
|
(map (x: removeAttrs x ["require"])
|
||||||
(uniqFlattenAttr (optionSet final) "require" [] (toList opts))
|
(uniqFlattenAttr (optionSet final) "require" [] (toList opts))
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
finalReferenceOptionSets = merge: pkgs: opts:
|
||||||
|
finalReference (finalOptionSetsFun merge pkgs opts);
|
||||||
|
|
||||||
optionAttrSetToDocList = (l: attrs:
|
optionAttrSetToDocList = (l: attrs:
|
||||||
(if (getAttr ["_type"] "" attrs) == "option" then
|
(if (getAttr ["_type"] "" attrs) == "option" then
|
||||||
|
Loading…
Reference in New Issue
Block a user