Merge branch 'quotaUsers' into 'main'

dovecot: fix quota users assertion

See merge request simple-nixos-mailserver/nixos-mailserver!511
This commit is contained in:
Martin Weinelt
2026-04-16 00:23:56 +00:00
+15 -14
View File
@@ -173,22 +173,23 @@ in
assertion = junkMailboxNumber == 1; assertion = junkMailboxNumber == 1;
message = "nixos-mailserver requires exactly one dovecot mailbox with the 'special_use' flag set to '\\Junk' (${builtins.toString junkMailboxNumber} have been found)"; message = "nixos-mailserver requires exactly one dovecot mailbox with the 'special_use' flag set to '\\Junk' (${builtins.toString junkMailboxNumber} have been found)";
} }
{ (
assertion = let
let usersWithQuota = attrNames (
usersWithQuota = attrNames ( filterAttrs (_: account: account.quota != null) config.mailserver.accounts
filterAttrs (_: account: account.quota != null) config.mailserver.loginAccounts );
); in
in {
!cfg.quota.enable -> usersWithQuota == { }; assertion = !cfg.quota.enable -> usersWithQuota == [ ];
message = '' message = ''
Without quota support enabled, per-user quotas cannot be applied to the following accounts: Without quota support enabled, per-user quotas cannot be applied to the following accounts:
${concatMapStringsSep "\n" (account: "- ${account}") quotaUsers} ${concatMapStringsSep "\n" (account: "- ${account}") usersWithQuota}
Either remove per user quota settings or re-enable `mailserver.quota.enable`. Either remove per user quota settings or re-enable `mailserver.quota.enable`.
''; '';
} }
)
]; ];
warnings = warnings =