Reload dovecot2 on certificate update.
This commit is contained in:
parent
743830f7c6
commit
925cabde64
1 changed files with 28 additions and 24 deletions
|
@ -11,29 +11,29 @@ with lib;
|
||||||
mailserver.nixosModules.mailserver
|
mailserver.nixosModules.mailserver
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// mkIf (elem "mailserver" config.machine.services) {
|
// mkIf (elem "mailserver" config.machine.services) (
|
||||||
mailserver =
|
let
|
||||||
let
|
cfg = config.machine;
|
||||||
cfg = config.machine;
|
inherit (cfg) domain;
|
||||||
inherit (cfg) domain;
|
fdomain = (findFirst (s: s.service == "mail") cfg cfg.vHosts).domain;
|
||||||
fdomain = (findFirst (s: s.service == "mail") cfg cfg.vHosts).domain;
|
mkFqdnAlias = name: [
|
||||||
mkFqdnAlias = name: [
|
"${name}@${domain}"
|
||||||
"${name}@${domain}"
|
"${name}@${fdomain}"
|
||||||
"${name}@${fdomain}"
|
];
|
||||||
];
|
mkExDomAlias = name: (map (exDom: "${name}@${exDom}") cfg.extraDomains);
|
||||||
mkExDomAlias = name: (map (exDom: "${name}@${exDom}") cfg.extraDomains);
|
mkUser = user: {
|
||||||
mkUser = user: rec {
|
name = "${user.name}@${domain}";
|
||||||
name = "${user.name}@${domain}";
|
value = {
|
||||||
value = {
|
hashedPasswordFile = config.sops.secrets."users/${user.name}/mail".path;
|
||||||
hashedPasswordFile = config.sops.secrets."users/${user.name}/mail".path;
|
aliases =
|
||||||
aliases =
|
[ "${user.name}@${fdomain}" ]
|
||||||
[ "${user.name}@${fdomain}" ]
|
++ (flatten (map mkFqdnAlias user.aliases))
|
||||||
++ (flatten (map mkFqdnAlias user.aliases))
|
++ (flatten (map mkExDomAlias ([ user.name ] ++ user.aliases)));
|
||||||
++ (flatten (map mkExDomAlias ([ user.name ] ++ user.aliases)));
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in
|
};
|
||||||
rec {
|
in
|
||||||
|
{
|
||||||
|
mailserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
fqdn = fdomain;
|
fqdn = fdomain;
|
||||||
domains = [
|
domains = [
|
||||||
|
@ -63,5 +63,9 @@ with lib;
|
||||||
# 1 Gb RAM for the server. Without virus scanning 256 MB RAM should be plenty)
|
# 1 Gb RAM for the server. Without virus scanning 256 MB RAM should be plenty)
|
||||||
virusScanning = false;
|
virusScanning = false;
|
||||||
};
|
};
|
||||||
sops.secrets = fn.sopsHelper (user: "users/${user.name}/mail") config.machine.mailAccounts { };
|
systemd.services."acme-${fdomain}".serviceConfig.ExecStartPost = [
|
||||||
}
|
"+systemctl reload dovecot2"
|
||||||
|
];
|
||||||
|
sops.secrets = fn.sopsHelper (user: "users/${user.name}/mail") config.machine.mailAccounts { };
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue