aboutsummaryrefslogtreecommitdiff
path: root/systems/eldiron/mail/default.nix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2023-10-04 01:35:06 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2023-10-04 02:11:48 +0200
commit1a64deeb894dc95e2645a75771732c6cc53a79ad (patch)
tree1b9df4838f894577a09b9b260151756272efeb53 /systems/eldiron/mail/default.nix
parentfa25ffd4583cc362075cd5e1b4130f33306103f0 (diff)
downloadNix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.gz
Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.zst
Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.zip
Squash changes containing private information
There were a lot of changes since the previous commit, but a lot of them contained personnal information about users. All thos changes got stashed into a single commit (history is kept in a different place) and private information was moved in a separate private repository
Diffstat (limited to 'systems/eldiron/mail/default.nix')
-rw-r--r--systems/eldiron/mail/default.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/systems/eldiron/mail/default.nix b/systems/eldiron/mail/default.nix
new file mode 100644
index 0000000..4e13f6a
--- /dev/null
+++ b/systems/eldiron/mail/default.nix
@@ -0,0 +1,44 @@
1{ lib, pkgs, config, ... }:
2{
3 imports = [
4 ./postfix.nix
5 ./dovecot.nix
6 ./rspamd.nix
7 ./sympa.nix
8 ];
9
10 options.myServices.mail.enable = lib.mkEnableOption "enable Mail services";
11 config = lib.mkIf config.myServices.mail.enable {
12 myServices.mail.milters.enable = true;
13 security.acme.certs."mail" = {
14 postRun = lib.mkBefore ''
15 cp -f fullchain.pem /etc/dovecot/fullchain.pem
16 chown :dovecot2 /etc/dovecot/fullchain.pem
17 chmod a+r /etc/dovecot/fullchain.pem
18 '';
19 domain = config.hostEnv.fqdn;
20 extraDomainNames = let
21 zonesWithMx = builtins.attrNames (lib.filterAttrs (n: v: v.hasEmail) config.myServices.dns.zones);
22 mxs = map (n: "${config.hostEnv.mx.subdomain}.${n}") zonesWithMx;
23 in mxs;
24 };
25 # This is for clients that don’t support elliptic curves (e.g.
26 # printer)
27 security.acme.certs."mail-rsa" = {
28 postRun = lib.mkBefore ''
29 cp -f fullchain.pem /etc/dovecot/fullchain-rsa.pem
30 chown :dovecot2 /etc/dovecot/fullchain-rsa.pem
31 chmod a+r /etc/dovecot/fullchain-rsa.pem
32 '';
33 domain = config.hostEnv.fqdn;
34 keyType = "rsa4096";
35 extraDomainNames = let
36 zonesWithMx = builtins.attrNames (lib.filterAttrs (n: v: v.hasEmail) config.myServices.dns.zones);
37 mxs = map (n: "${config.hostEnv.mx.subdomain}.${n}") zonesWithMx;
38 in mxs;
39 };
40 systemd.slices.mail = {
41 description = "Mail slice";
42 };
43 };
44}