diff options
author | Shea Levy <shea@shealevy.com> | 2014-05-01 11:30:20 -0400 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2014-05-01 11:30:20 -0400 |
commit | ab2cd34076cceef0288a05b40afee1160c44d40b (patch) | |
tree | 87ba8beee472e7c193f1b508caca1732dff49f11 /lib | |
parent | e4630c1d41d513eb709bddb39043da84442235a7 (diff) | |
download | nixpkgs-ab2cd34076cceef0288a05b40afee1160c44d40b.tar nixpkgs-ab2cd34076cceef0288a05b40afee1160c44d40b.tar.gz nixpkgs-ab2cd34076cceef0288a05b40afee1160c44d40b.tar.bz2 nixpkgs-ab2cd34076cceef0288a05b40afee1160c44d40b.tar.lz nixpkgs-ab2cd34076cceef0288a05b40afee1160c44d40b.tar.xz nixpkgs-ab2cd34076cceef0288a05b40afee1160c44d40b.tar.zst nixpkgs-ab2cd34076cceef0288a05b40afee1160c44d40b.zip |
Add enum option type
Diffstat (limited to 'lib')
-rw-r--r-- | lib/types.nix | 6 |
1 files changed, 6 insertions, 0 deletions
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. |