nixos/postgrey: prefer types.ints over addCheck

This commit is contained in:
h7x4
2025-09-12 02:29:08 +02:00
parent c1a2638df6
commit 3c811c4f71
+6 -9
View File
@@ -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";
};