diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-01-10 00:01:45 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-01-10 00:01:45 +0100 |
commit | 619e4f46adc15e409122c4e0fa0e0a0b811bb32f (patch) | |
tree | 20f29e51aec4bcb1176b5d19b8d1f8358268b7ba /modules/private/mail/default.nix | |
parent | fd2af8fa50dc1a60d40a1aa3c4252d8eb3abf5b0 (diff) | |
download | Nix-619e4f46adc15e409122c4e0fa0e0a0b811bb32f.tar.gz Nix-619e4f46adc15e409122c4e0fa0e0a0b811bb32f.tar.zst Nix-619e4f46adc15e409122c4e0fa0e0a0b811bb32f.zip |
Add backup MX
Diffstat (limited to 'modules/private/mail/default.nix')
-rw-r--r-- | modules/private/mail/default.nix | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/private/mail/default.nix b/modules/private/mail/default.nix index a617934..b50e346 100644 --- a/modules/private/mail/default.nix +++ b/modules/private/mail/default.nix | |||
@@ -1,23 +1,25 @@ | |||
1 | { lib, pkgs, config, ... }: | 1 | { lib, pkgs, config, ... }: |
2 | { | 2 | { |
3 | imports = [ | 3 | imports = [ |
4 | ./milters.nix | 4 | ./milters.nix |
5 | ./postfix.nix | 5 | ./postfix.nix |
6 | ./dovecot.nix | 6 | ./dovecot.nix |
7 | ./relay.nix | ||
7 | ./rspamd.nix | 8 | ./rspamd.nix |
8 | ./opensmtpd.nix | 9 | ./opensmtpd.nix |
9 | ]; | 10 | ]; |
10 | options.myServices.mail.enable = lib.mkEnableOption "enable Mail services"; | 11 | options.myServices.mail.enable = lib.mkEnableOption "enable Mail services"; |
11 | options.myServices.mailRelay.enable = lib.mkEnableOption "enable Mail relay services"; | 12 | options.myServices.mailRelay.enable = lib.mkEnableOption "enable Mail relay services"; |
13 | options.myServices.mailBackup.enable = lib.mkEnableOption "enable MX backup services"; | ||
12 | 14 | ||
13 | config = lib.mkIf config.myServices.mail.enable { | 15 | config = lib.mkIf config.myServices.mail.enable { |
14 | security.acme.certs."mail" = config.myServices.certificates.certConfig // { | 16 | security.acme.certs."mail" = config.myServices.certificates.certConfig // { |
15 | domain = "eldiron.immae.eu"; | 17 | domain = config.hostEnv.fqdn; |
16 | extraDomains = let | 18 | extraDomains = let |
17 | zonesWithMx = builtins.filter (zone: | 19 | zonesWithMx = builtins.filter (zone: |
18 | lib.attrsets.hasAttr "withEmail" zone && lib.lists.length zone.withEmail > 0 | 20 | lib.attrsets.hasAttr "withEmail" zone && lib.lists.length zone.withEmail > 0 |
19 | ) config.myEnv.dns.masterZones; | 21 | ) config.myEnv.dns.masterZones; |
20 | mxs = map (zone: "mx-1.${zone.name}") zonesWithMx; | 22 | mxs = map (zone: "${config.hostEnv.mx.subdomain}.${zone.name}") zonesWithMx; |
21 | in builtins.listToAttrs (map (mx: lib.attrsets.nameValuePair mx null) mxs); | 23 | in builtins.listToAttrs (map (mx: lib.attrsets.nameValuePair mx null) mxs); |
22 | }; | 24 | }; |
23 | services.duplyBackup.profiles = { | 25 | services.duplyBackup.profiles = { |