diff --git a/nixos/modules/services/mail/postgrey.nix b/nixos/modules/services/mail/postgrey.nix index 53c54c15c5d0..463757fa8440 100644 --- a/nixos/modules/services/mail/postgrey.nix +++ b/nixos/modules/services/mail/postgrey.nix @@ -10,9 +10,6 @@ let cfg = config.services.postgrey; - natural = with types; addCheck int (x: x >= 0); - natural' = with types; addCheck int (x: x > 0); - socket = with types; addCheck (either (submodule unixSocket) (submodule inetSocket)) (x: x ? path || x ? port); @@ -127,17 +124,17 @@ in description = "Prepend header to greylisted mails; use %%t for seconds delayed due to greylisting, %%v for the version of postgrey, %%d for the date, and %%h for the host"; }; delay = mkOption { - type = natural; + type = ints.unsigned; default = 300; description = "Greylist for N seconds"; }; maxAge = mkOption { - type = natural; + type = ints.unsigned; default = 35; description = "Delete entries from whitelist if they haven't been seen for N days"; }; retryWindow = mkOption { - type = either str natural; + type = either str ints.unsigned; default = 2; example = "12h"; description = "Allow N days for the first retry. Use string with appended 'h' to specify time in hours"; @@ -148,12 +145,12 @@ in description = "Strip the last N bits from IP addresses, determined by IPv4CIDR and IPv6CIDR"; }; IPv4CIDR = mkOption { - type = natural; + type = ints.unsigned; default = 24; description = "Strip N bits from IPv4 addresses if lookupBySubnet is true"; }; IPv6CIDR = mkOption { - type = natural; + type = ints.unsigned; default = 64; description = "Strip N bits from IPv6 addresses if lookupBySubnet is true"; }; @@ -163,7 +160,7 @@ in description = "Store data using one-way hash functions (SHA1)"; }; autoWhitelist = mkOption { - type = nullOr natural'; + type = nullOr ints.positive; default = 5; description = "Whitelist clients after successful delivery of N messages"; }; diff --git a/nixos/modules/services/networking/monero.nix b/nixos/modules/services/networking/monero.nix index 9da570bbb5e2..5c0388aee32a 100644 --- a/nixos/modules/services/networking/monero.nix +++ b/nixos/modules/services/networking/monero.nix @@ -107,7 +107,7 @@ in }; mining.threads = lib.mkOption { - type = lib.types.addCheck lib.types.int (x: x >= 0); + type = lib.types.ints.unsigned; default = 0; description = '' Number of threads used for mining. @@ -174,7 +174,7 @@ in }; limits.threads = lib.mkOption { - type = lib.types.addCheck lib.types.int (x: x >= 0); + type = lib.types.ints.unsigned; default = 0; description = '' Maximum number of threads used for a parallel job. @@ -183,7 +183,7 @@ in }; limits.syncSize = lib.mkOption { - type = lib.types.addCheck lib.types.int (x: x >= 0); + type = lib.types.ints.unsigned; default = 0; description = '' Maximum number of blocks to sync at once. diff --git a/nixos/modules/services/networking/tayga.nix b/nixos/modules/services/networking/tayga.nix index 8a039aa75abf..7ed0cf51e561 100644 --- a/nixos/modules/services/networking/tayga.nix +++ b/nixos/modules/services/networking/tayga.nix @@ -42,7 +42,7 @@ let }; prefixLength = mkOption { - type = types.addCheck types.int (n: n >= 0 && n <= (if v == 4 then 32 else 128)); + type = types.ints.between 0 (if v == 4 then 32 else 128); description = '' Subnet mask of the interface, specified as the number of bits in the prefix ("${if v == 4 then "24" else "64"}"). diff --git a/nixos/modules/services/networking/tinc.nix b/nixos/modules/services/networking/tinc.nix index 709431026739..a26b2af96cd7 100644 --- a/nixos/modules/services/networking/tinc.nix +++ b/nixos/modules/services/networking/tinc.nix @@ -72,7 +72,7 @@ let }; prefixLength = mkOption { - type = with types; nullOr (addCheck int (n: n >= 0 && n <= 128)); + type = with types; nullOr (ints.between 0 128); default = null; description = '' The prefix length of the subnet. @@ -227,7 +227,7 @@ in debugLevel = mkOption { default = 0; - type = types.addCheck types.int (l: l >= 0 && l <= 5); + type = types.ints.between 0 5; description = '' The amount of debugging information to add to the log. 0 means little logging while 5 is the most logging. {command}`man tincd` for diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 09b6cec4e7ea..4b7e788bc33b 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -82,7 +82,7 @@ let }; prefixLength = mkOption { - type = types.addCheck types.int (n: n >= 0 && n <= (if v == 4 then 32 else 128)); + type = types.ints.between 0 (if v == 4 then 32 else 128); description = '' Subnet mask of the interface, specified as the number of bits in the prefix (`${if v == 4 then "24" else "64"}`). @@ -99,7 +99,7 @@ let }; prefixLength = mkOption { - type = types.addCheck types.int (n: n >= 0 && n <= (if v == 4 then 32 else 128)); + type = types.ints.between 0 (if v == 4 then 32 else 128); description = '' Subnet mask of the network, specified as the number of bits in the prefix (`${if v == 4 then "24" else "64"}`).