about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorJoachim F <joachifm@users.noreply.github.com>2016-11-05 12:18:04 +0100
committerGitHub <noreply@github.com>2016-11-05 12:18:04 +0100
commit2c567dbd4d09eeb9c4cbda1ac3681cf74b9e4980 (patch)
tree3fdc29f1664e313620d783dec510e7749dca2c76 /nixos/modules/services
parent2df4d24a7484fd8d9447d242290846a3f67ca71c (diff)
parent986510de4562c532beb3c9d794f56e2d8015c9fc (diff)
downloadnixlib-2c567dbd4d09eeb9c4cbda1ac3681cf74b9e4980.tar
nixlib-2c567dbd4d09eeb9c4cbda1ac3681cf74b9e4980.tar.gz
nixlib-2c567dbd4d09eeb9c4cbda1ac3681cf74b9e4980.tar.bz2
nixlib-2c567dbd4d09eeb9c4cbda1ac3681cf74b9e4980.tar.lz
nixlib-2c567dbd4d09eeb9c4cbda1ac3681cf74b9e4980.tar.xz
nixlib-2c567dbd4d09eeb9c4cbda1ac3681cf74b9e4980.tar.zst
nixlib-2c567dbd4d09eeb9c4cbda1ac3681cf74b9e4980.zip
Merge pull request #20144 from ericsagnes/feat/module-enums
modules: use enum when relevant
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/games/ghost-one.nix3
-rw-r--r--nixos/modules/services/logging/logcheck.nix4
-rw-r--r--nixos/modules/services/networking/bitlbee.nix7
-rw-r--r--nixos/modules/services/networking/tinc.nix2
-rw-r--r--nixos/modules/services/web-servers/fcgiwrap.nix2
5 files changed, 6 insertions, 12 deletions
diff --git a/nixos/modules/services/games/ghost-one.nix b/nixos/modules/services/games/ghost-one.nix
index 5762148df2bb..71ff6bb2f3f0 100644
--- a/nixos/modules/services/games/ghost-one.nix
+++ b/nixos/modules/services/games/ghost-one.nix
@@ -21,8 +21,7 @@ in
 
       language = mkOption {
         default = "English";
-        type = types.addCheck types.str
-          (lang: elem lang [ "English" "Spanish" "Russian" "Serbian" "Turkish" ]);
+        type = types.enum [ "English" "Spanish" "Russian" "Serbian" "Turkish" ];
         description = "The language of bot messages: English, Spanish, Russian, Serbian or Turkish.";
       };
 
diff --git a/nixos/modules/services/logging/logcheck.nix b/nixos/modules/services/logging/logcheck.nix
index a8a214b21550..27ed5374f561 100644
--- a/nixos/modules/services/logging/logcheck.nix
+++ b/nixos/modules/services/logging/logcheck.nix
@@ -55,9 +55,9 @@ let
 
   levelOption = mkOption {
     default = "server";
-    type = types.str;
+    type = types.enum [ "workstation" "server" "paranoid" ];
     description = ''
-      Set the logcheck level. Either "workstation", "server", or "paranoid".
+      Set the logcheck level.
     '';
   };
 
diff --git a/nixos/modules/services/networking/bitlbee.nix b/nixos/modules/services/networking/bitlbee.nix
index 5e6847097a94..e72ea20cccee 100644
--- a/nixos/modules/services/networking/bitlbee.nix
+++ b/nixos/modules/services/networking/bitlbee.nix
@@ -7,11 +7,6 @@ let
   cfg = config.services.bitlbee;
   bitlbeeUid = config.ids.uids.bitlbee;
 
-  authModeCheck = v:
-    v == "Open" ||
-    v == "Closed" ||
-    v == "Registered";
-
   bitlbeeConfig = pkgs.writeText "bitlbee.conf"
     ''
     [settings]
@@ -67,7 +62,7 @@ in
 
       authMode = mkOption {
         default = "Open";
-        type = types.addCheck types.str authModeCheck;
+        type = types.enum [ "Open" "Closed" "Registered" ];
         description = ''
           The following authentication modes are available:
             Open -- Accept connections from anyone, use NickServ for user authentication.
diff --git a/nixos/modules/services/networking/tinc.nix b/nixos/modules/services/networking/tinc.nix
index b26d30597b1f..f8e68fda7fc2 100644
--- a/nixos/modules/services/networking/tinc.nix
+++ b/nixos/modules/services/networking/tinc.nix
@@ -68,7 +68,7 @@ in
 
             interfaceType = mkOption {
               default = "tun";
-              type = types.addCheck types.str (n: n == "tun" || n == "tap");
+              type = types.enum [ "tun" "tap" ];
               description = ''
                 The type of virtual interface used for the network connection
               '';
diff --git a/nixos/modules/services/web-servers/fcgiwrap.nix b/nixos/modules/services/web-servers/fcgiwrap.nix
index 2c5e433003c8..a64a187255a4 100644
--- a/nixos/modules/services/web-servers/fcgiwrap.nix
+++ b/nixos/modules/services/web-servers/fcgiwrap.nix
@@ -21,7 +21,7 @@ in {
       };
 
       socketType = mkOption {
-        type = types.addCheck types.str (t: t == "unix" || t == "tcp" || t == "tcp6");
+        type = types.enum [ "unix" "tcp" "tcp6" ];
         default = "unix";
         description = "Socket type: 'unix', 'tcp' or 'tcp6'.";
       };