mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
Add enum option type
This commit is contained in:
parent
e4630c1d41
commit
ab2cd34076
1 changed files with 6 additions and 0 deletions
|
@ -194,6 +194,12 @@ rec {
|
|||
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
|
||||
# declarations from the ‘options’ attribute of containing option
|
||||
# declaration.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue