diff --git a/modules/services/mail/postfix.nix b/modules/services/mail/postfix.nix index 93596028678..939260632c9 100644 --- a/modules/services/mail/postfix.nix +++ b/modules/services/mail/postfix.nix @@ -283,11 +283,13 @@ in # accurate way is unlikely to be better. { description = "Postfix mail server"; - startOn = "started ${startingDependency} and filesystems"; + startOn = "started ${startingDependency}"; - daemonType = "fork"; + daemonType = "none"; - script = + respawn = false; + + preStart = '' if ! [ -d /var/spool/postfix ]; then ${pkgs.coreutils}/bin/mkdir -p /var/spool/mail /var/postfix/conf /var/postfix/queue @@ -309,6 +311,10 @@ in exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start ''; # */ + preStop = '' + exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf stop + ''; + }; };