git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #20144 from ericsagnes/feat/module-enums

modules: use enum when relevant

commit2c567dbd4d09eeb9c4cbda1ac3681cf74b9e4980 authorJoachim F <joachifm@users.noreply.github.com> dateSat 5 Nov 2016, 12:18 (10 years ago) parent2df4d24986510d
7 files changed+8−15
nixos/modules/services/games/ghost-one.nix+1−2 nixos/modules/services/logging/logcheck.nix+2−2 nixos/modules/services/networking/bitlbee.nix+1−6 nixos/modules/services/networking/tinc.nix+1−1 nixos/modules/services/web-servers/fcgiwrap.nix+1−1 nixos/modules/system/boot/loader/grub/grub.nix+1−2 nixos/modules/tasks/network-interfaces.nix+1−1
nixos/modules/services/games/ghost-one.nix+1−2
@@ -21,8 +21,7 @@ in
2121
2222 language = mkOption {
2323 default = "English";
24− type = types.addCheck types.str
25− (lang: elem lang [ "English" "Spanish" "Russian" "Serbian" "Turkish" ]);
24+ type = types.enum [ "English" "Spanish" "Russian" "Serbian" "Turkish" ];
2625 description = "The language of bot messages: English, Spanish, Russian, Serbian or Turkish.";
2726 };
2827
nixos/modules/services/logging/logcheck.nix+2−2
@@ -55,9 +55,9 @@ let
5555
5656 levelOption = mkOption {
5757 default = "server";
58− type = types.str;
58+ type = types.enum [ "workstation" "server" "paranoid" ];
5959 description = ''
60− Set the logcheck level. Either "workstation", "server", or "paranoid".
60+ Set the logcheck level.
6161 '';
6262 };
6363
nixos/modules/services/networking/bitlbee.nix+1−6
@@ -7,11 +7,6 @@ let
77 cfg = config.services.bitlbee;
88 bitlbeeUid = config.ids.uids.bitlbee;
99
10− authModeCheck = v:
11− v == "Open" ||
12− v == "Closed" ||
13− v == "Registered";
14−
1510 bitlbeeConfig = pkgs.writeText "bitlbee.conf"
1611 ''
1712 [settings]
@@ -67,7 +62,7 @@ in
6762
6863 authMode = mkOption {
6964 default = "Open";
70− type = types.addCheck types.str authModeCheck;
65+ type = types.enum [ "Open" "Closed" "Registered" ];
7166 description = ''
7267 The following authentication modes are available:
7368 Open -- Accept connections from anyone, use NickServ for user authentication.
nixos/modules/services/networking/tinc.nix+1−1
@@ -68,7 +68,7 @@ in
6868
6969 interfaceType = mkOption {
7070 default = "tun";
71− type = types.addCheck types.str (n: n == "tun" || n == "tap");
71+ type = types.enum [ "tun" "tap" ];
7272 description = ''
7373 The type of virtual interface used for the network connection
7474 '';
nixos/modules/services/web-servers/fcgiwrap.nix+1−1
@@ -21,7 +21,7 @@ in {
2121 };
2222
2323 socketType = mkOption {
24− type = types.addCheck types.str (t: t == "unix" || t == "tcp" || t == "tcp6");
24+ type = types.enum [ "unix" "tcp" "tcp6" ];
2525 default = "unix";
2626 description = "Socket type: 'unix', 'tcp' or 'tcp6'.";
2727 };
nixos/modules/system/boot/loader/grub/grub.nix+1−2
@@ -324,8 +324,7 @@ in
324324
325325 fsIdentifier = mkOption {
326326 default = "uuid";
327− type = types.addCheck types.str
328− (type: type == "uuid" || type == "label" || type == "provided");
327+ type = types.enum [ "uuid" "label" "provided" ];
329328 description = ''
330329 Determines how GRUB will identify devices when generating the
331330 configuration file. A value of uuid / label signifies that grub
nixos/modules/tasks/network-interfaces.nix+1−1
@@ -245,7 +245,7 @@ let
245245
246246 virtualType = mkOption {
247247 default = null;
248− type = types.nullOr (types.addCheck types.str (v: v == "tun" || v == "tap"));
248+ type = with types; nullOr (enum [ "tun" "tap" ]);
249249 description = ''
250250 The explicit type of interface to create. Accepts tun or tap strings.
251251 Also accepts null to implicitly detect the type of device.