blob: d893ec49d53184bb4cd495fca0bc3e82765be37d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
{ 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.acme.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);
};
# This is for clients that don’t support elliptic curves (e.g.
# printer)
security.acme.certs."mail-rsa" = config.myServices.certificates.certConfig // {
domain = config.hostEnv.fqdn;
keyType = "rsa4096";
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
'';
};
};
};
}
|