Merge pull request #20144 from ericsagnes/feat/module-enums
modules: use enum when relevant
This commit is contained in:
commit
2c567dbd4d
@ -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.";
|
||||
};
|
||||
|
||||
|
@ -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.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
'';
|
||||
|
@ -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'.";
|
||||
};
|
||||
|
@ -324,8 +324,7 @@ in
|
||||
|
||||
fsIdentifier = mkOption {
|
||||
default = "uuid";
|
||||
type = types.addCheck types.str
|
||||
(type: type == "uuid" || type == "label" || type == "provided");
|
||||
type = types.enum [ "uuid" "label" "provided" ];
|
||||
description = ''
|
||||
Determines how GRUB will identify devices when generating the
|
||||
configuration file. A value of uuid / label signifies that grub
|
||||
|
@ -245,7 +245,7 @@ let
|
||||
|
||||
virtualType = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.addCheck types.str (v: v == "tun" || v == "tap"));
|
||||
type = with types; nullOr (enum [ "tun" "tap" ]);
|
||||
description = ''
|
||||
The explicit type of interface to create. Accepts tun or tap strings.
|
||||
Also accepts null to implicitly detect the type of device.
|
||||
|
Loading…
Reference in New Issue
Block a user