forked from mirrors/nixpkgs
Add enum option type
This commit is contained in:
parent
e4630c1d41
commit
ab2cd34076
|
@ -194,6 +194,12 @@ rec {
|
||||||
args = { name = ""; }; }).options;
|
args = { name = ""; }; }).options;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum = values: mkOptionType {
|
||||||
|
name = "one of ${concatStringsSep ", " values}.";
|
||||||
|
check = flip elem values;
|
||||||
|
merge = mergeOneOption;
|
||||||
|
};
|
||||||
|
|
||||||
# Obsolete alternative to configOf. It takes its option
|
# Obsolete alternative to configOf. It takes its option
|
||||||
# declarations from the ‘options’ attribute of containing option
|
# declarations from the ‘options’ attribute of containing option
|
||||||
# declaration.
|
# declaration.
|
||||||
|
|
Loading…
Reference in a new issue