2023-05-20 09:52:25 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2025-04-15 07:31:12 +02:00
|
|
|
let
|
|
|
|
cfg = config.mailserver;
|
|
|
|
in {
|
|
|
|
assertions = lib.optionals cfg.ldap.enable [
|
2023-05-20 09:52:25 +02:00
|
|
|
{
|
2025-04-15 07:31:12 +02:00
|
|
|
assertion = cfg.loginAccounts == {};
|
2023-05-20 09:52:25 +02:00
|
|
|
message = "When the LDAP support is enable (mailserver.ldap.enable = true), it is not possible to define mailserver.loginAccounts";
|
|
|
|
}
|
|
|
|
{
|
2025-04-15 07:31:12 +02:00
|
|
|
assertion = cfg.extraVirtualAliases == {};
|
2023-05-20 09:52:25 +02:00
|
|
|
message = "When the LDAP support is enable (mailserver.ldap.enable = true), it is not possible to define mailserver.extraVirtualAliases";
|
|
|
|
}
|
|
|
|
{
|
2025-04-15 07:31:12 +02:00
|
|
|
assertion = cfg.forwards == {};
|
2023-05-20 09:52:25 +02:00
|
|
|
message = "When the LDAP support is enable (mailserver.ldap.enable = true), it is not possible to define mailserver.forwards";
|
|
|
|
}
|
2025-04-15 07:31:12 +02:00
|
|
|
] ++ lib.optionals (cfg.enable && cfg.certificateScheme != "acme") [
|
2023-06-28 20:42:37 +01:00
|
|
|
{
|
2025-04-15 07:31:12 +02:00
|
|
|
assertion = cfg.acmeCertificateName == cfg.fqdn;
|
2023-06-28 20:42:37 +01:00
|
|
|
message = "When the certificate scheme is not 'acme' (mailserver.certificateScheme != \"acme\"), it is not possible to define mailserver.acmeCertificateName";
|
|
|
|
}
|
2025-04-15 07:20:46 +02:00
|
|
|
] ++ lib.optionals cfg.dkimSigning (
|
|
|
|
let
|
|
|
|
missingDomains = builtins.filter (d: !(cfg.dkimSelector ? "${d}")) cfg.domains;
|
|
|
|
in [
|
|
|
|
{
|
|
|
|
assertion = missingDomains == [];
|
|
|
|
message = "Missing DKIM selector for domains: ${builtins.concatStringsSep ", " missingDomains}";
|
|
|
|
}
|
|
|
|
]);
|
2023-05-20 09:52:25 +02:00
|
|
|
}
|