|
|
|
@ -723,23 +723,10 @@ in |
|
|
|
|
{ ${setgidGroup}.gid = config.ids.gids.postdrop; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
systemd.services.postfix = |
|
|
|
|
{ description = "Postfix mail server"; |
|
|
|
|
|
|
|
|
|
wantedBy = [ "multi-user.target" ]; |
|
|
|
|
after = [ "network.target" ]; |
|
|
|
|
path = [ pkgs.postfix ]; |
|
|
|
|
|
|
|
|
|
serviceConfig = { |
|
|
|
|
Type = "forking"; |
|
|
|
|
Restart = "always"; |
|
|
|
|
PIDFile = "/var/lib/postfix/queue/pid/master.pid"; |
|
|
|
|
ExecStart = "${pkgs.postfix}/bin/postfix start"; |
|
|
|
|
ExecStop = "${pkgs.postfix}/bin/postfix stop"; |
|
|
|
|
ExecReload = "${pkgs.postfix}/bin/postfix reload"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
preStart = '' |
|
|
|
|
systemd.services.postfix-setup = |
|
|
|
|
{ description = "Setup for Postfix mail server"; |
|
|
|
|
serviceConfig.Type = "oneshot"; |
|
|
|
|
script = '' |
|
|
|
|
# Backwards compatibility |
|
|
|
|
if [ ! -d /var/lib/postfix ] && [ -d /var/postfix ]; then |
|
|
|
|
mkdir -p /var/lib |
|
|
|
@ -777,6 +764,24 @@ in |
|
|
|
|
''; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
systemd.services.postfix = |
|
|
|
|
{ description = "Postfix mail server"; |
|
|
|
|
|
|
|
|
|
wantedBy = [ "multi-user.target" ]; |
|
|
|
|
after = [ "network.target" "postfix-setup.service" ]; |
|
|
|
|
requires = [ "postfix-setup.service" ]; |
|
|
|
|
path = [ pkgs.postfix ]; |
|
|
|
|
|
|
|
|
|
serviceConfig = { |
|
|
|
|
Type = "forking"; |
|
|
|
|
Restart = "always"; |
|
|
|
|
PIDFile = "/var/lib/postfix/queue/pid/master.pid"; |
|
|
|
|
ExecStart = "${pkgs.postfix}/bin/postfix start"; |
|
|
|
|
ExecStop = "${pkgs.postfix}/bin/postfix stop"; |
|
|
|
|
ExecReload = "${pkgs.postfix}/bin/postfix reload"; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
services.postfix.config = (mapAttrs (_: v: mkDefault v) { |
|
|
|
|
compatibility_level = pkgs.postfix.version; |
|
|
|
|
mail_owner = cfg.user; |
|
|
|
|