From ab2cd34076cceef0288a05b40afee1160c44d40b Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Thu, 1 May 2014 11:30:20 -0400 Subject: [PATCH] Add enum option type --- lib/types.nix | 6 ++++++ 1 file changed, 6 insertions(+) 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.