1 { lib, pkgs, config, ... }:
12 options.myServices.mail.enable = lib.mkEnableOption "enable Mail services";
13 options.myServices.mailRelay.enable = lib.mkEnableOption "enable Mail relay services";
14 options.myServices.mailBackup.enable = lib.mkEnableOption "enable MX backup services";
16 config = lib.mkIf config.myServices.mail.enable {
17 security.acme.certs."mail" = config.myServices.certificates.certConfig // {
18 domain = config.hostEnv.fqdn;
20 zonesWithMx = builtins.filter (zone:
21 lib.attrsets.hasAttr "withEmail" zone && lib.lists.length zone.withEmail > 0
22 ) config.myEnv.dns.masterZones;
23 mxs = map (zone: "${config.hostEnv.mx.subdomain}.${zone.name}") zonesWithMx;
24 in builtins.listToAttrs (map (mx: lib.attrsets.nameValuePair mx null) mxs);
26 # This is for clients that don’t support elliptic curves (e.g.
28 security.acme.certs."mail-rsa" = config.myServices.certificates.certConfig // {
29 domain = config.hostEnv.fqdn;
32 zonesWithMx = builtins.filter (zone:
33 lib.attrsets.hasAttr "withEmail" zone && lib.lists.length zone.withEmail > 0
34 ) config.myEnv.dns.masterZones;
35 mxs = map (zone: "${config.hostEnv.mx.subdomain}.${zone.name}") zonesWithMx;
36 in builtins.listToAttrs (map (mx: lib.attrsets.nameValuePair mx null) mxs);
38 services.duplyBackup.profiles = {
41 excludeFile = lib.mkAfter ''