diff --git a/lib/types.nix b/lib/types.nix index baf8aa5e574..6ce54bfae4e 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -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.