blob: 1c64e158be5aa035a5718eb41fb55493c052d098 (
plain) (
tree)
|
|
{ lib, pkgs, config, ... }:
{
imports = [
./milters.nix
./postfix.nix
./dovecot.nix
./relay.nix
./rspamd.nix
./opensmtpd.nix
];
options.myServices.mail.enable = lib.mkEnableOption "enable Mail services";
options.myServices.mailRelay.enable = lib.mkEnableOption "enable Mail relay services";
options.myServices.mailBackup.enable = lib.mkEnableOption "enable MX backup services";
config = lib.mkIf config.myServices.mail.enable {
security.acme2.certs."mail" = config.myServices.certificates.certConfig // {
domain = config.hostEnv.fqdn;
extraDomains = let
zonesWithMx = builtins.filter (zone:
lib.attrsets.hasAttr "withEmail" zone && lib.lists.length zone.withEmail > 0
) config.myEnv.dns.masterZones;
mxs = map (zone: "${config.hostEnv.mx.subdomain}.${zone.name}") zonesWithMx;
in builtins.listToAttrs (map (mx: lib.attrsets.nameValuePair mx null) mxs);
};
services.duplyBackup.profiles = {
mail = {
rootDir = "/var/lib";
excludeFile = lib.mkAfter ''
+ /var/lib/vhost
- /var/lib
'';
};
};
};
}
|