nixos/modules: Replace all nested types.either's with types.oneOf's

This commit is contained in:
Silvan Mosberger 2019-08-08 23:35:52 +02:00
parent 9a44f44d4c
commit 88bb9fa403
No known key found for this signature in database
GPG Key ID: 9424360B4B85C9E7
12 changed files with 13 additions and 13 deletions

View File

@ -41,7 +41,7 @@ in
}; };
config = mkOption { config = mkOption {
type = with types; attrsOf (either (either str (either int bool)) (listOf str)); type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
default = {}; default = {};
description = '' description = ''
automysqlbackup configuration. Refer to automysqlbackup configuration. Refer to

View File

@ -118,7 +118,7 @@ in {
}; };
serverProperties = mkOption { serverProperties = mkOption {
type = with types; attrsOf (either bool (either int str)); type = with types; attrsOf (oneOf [ bool int str ]);
default = {}; default = {};
example = literalExample '' example = literalExample ''
{ {

View File

@ -7,7 +7,7 @@ let
cfg = config.services.davmail; cfg = config.services.davmail;
configType = with types; configType = with types;
either (either (attrsOf configType) str) (either int bool) // { oneOf [ (attrsOf configType) str int bool ] // {
description = "davmail config type (str, int, bool or attribute set thereof)"; description = "davmail config type (str, int, bool or attribute set thereof)";
}; };

View File

@ -447,7 +447,7 @@ in
}; };
config = mkOption { config = mkOption {
type = with types; attrsOf (either bool (either str (listOf str))); type = with types; attrsOf (oneOf [ bool str (listOf str) ]);
description = '' description = ''
The main.cf configuration file as key value set. The main.cf configuration file as key value set.
''; '';

View File

@ -331,7 +331,7 @@ in
}; };
config = mkOption { config = mkOption {
type = with types; attrsOf (either bool (either str (listOf str))); type = with types; attrsOf (oneOf [ bool str (listOf str) ]);
description = '' description = ''
Addon to postfix configuration Addon to postfix configuration
''; '';

View File

@ -30,7 +30,7 @@ in {
}; };
config = mkOption { config = mkOption {
type = with types; attrsOf (either str (either int bool)); type = with types; attrsOf (oneOf [ str int bool ]);
default = {}; default = {};
description = '' description = ''
The configuration to give rss2email. The configuration to give rss2email.

View File

@ -62,9 +62,9 @@ let
concatStringsSep "\n" (toLines cfg.config); concatStringsSep "\n" (toLines cfg.config);
semanticTypes = with types; rec { semanticTypes = with types; rec {
zncAtom = nullOr (either (either int bool) str); zncAtom = nullOr (oneOf [ int bool str ]);
zncAttr = attrsOf (nullOr zncConf); zncAttr = attrsOf (nullOr zncConf);
zncAll = either (either zncAtom (listOf zncAtom)) zncAttr; zncAll = oneOf [ zncAtom (listOf zncAtom) zncAttr ];
zncConf = attrsOf (zncAll // { zncConf = attrsOf (zncAll // {
# Since this is a recursive type and the description by default contains # Since this is a recursive type and the description by default contains
# the description of its subtypes, infinite recursion would occur without # the description of its subtypes, infinite recursion would occur without

View File

@ -36,7 +36,7 @@ in {
}; };
config = mkOption { config = mkOption {
type = attrsOf (nullOr (either (either bool int) str)); type = attrsOf (nullOr (oneOf [ bool int str ]));
default = {}; default = {};
example = literalExample '' example = literalExample ''
{ {

View File

@ -14,7 +14,7 @@ let
pkg = pkgs.limesurvey; pkg = pkgs.limesurvey;
configType = with types; either (either (attrsOf configType) str) (either int bool) // { configType = with types; oneOf [ (attrsOf configType) str int bool ] // {
description = "limesurvey config type (str, int, bool or attribute set thereof)"; description = "limesurvey config type (str, int, bool or attribute set thereof)";
}; };

View File

@ -215,7 +215,7 @@ in {
}; };
settings = let settings = let
configTypes = with types; either bool (either int (either float str)); configTypes = with types; oneOf [ bool int float str ];
# types.loaOf converts lists to sets # types.loaOf converts lists to sets
loaOf = t: with types; either (listOf t) (attrsOf t); loaOf = t: with types; either (listOf t) (attrsOf t);
in mkOption { in mkOption {

View File

@ -226,7 +226,7 @@ in rec {
environment = mkOption { environment = mkOption {
default = {}; default = {};
type = with types; attrsOf (nullOr (either str (either path package))); type = with types; attrsOf (nullOr (oneOf [ str path package ]));
example = { PATH = "/foo/bar/bin"; LANG = "nl_NL.UTF-8"; }; example = { PATH = "/foo/bar/bin"; LANG = "nl_NL.UTF-8"; };
description = "Environment variables passed to the service's processes."; description = "Environment variables passed to the service's processes.";
}; };

View File

@ -520,7 +520,7 @@ in
}; };
systemd.globalEnvironment = mkOption { systemd.globalEnvironment = mkOption {
type = with types; attrsOf (nullOr (either str (either path package))); type = with types; attrsOf (nullOr (oneOf [ str path package ]));
default = {}; default = {};
example = { TZ = "CET"; }; example = { TZ = "CET"; };
description = '' description = ''