diff --git a/modules/services/mail/postfix.nix b/modules/services/mail/postfix.nix index 3784ae3d39f..d4505818e0c 100644 --- a/modules/services/mail/postfix.nix +++ b/modules/services/mail/postfix.nix @@ -318,22 +318,13 @@ in # accurate way is unlikely to be better. { description = "Postfix mail server"; - startOn = "started networking and filesystem"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; - daemonType = "none"; - - respawn = true; + daemonType = "fork"; environment.TZ = config.time.timeZone; - script = '' - while ${pkgs.procps}/bin/ps `${pkgs.coreutils}/bin/cat /var/postfix/queue/pid/master.pid` | - grep -q postfix - do - ${pkgs.coreutils}/bin/sleep 1m - done - ''; - preStart = '' if ! [ -d /var/spool/postfix ]; then @@ -346,7 +337,7 @@ in ${pkgs.coreutils}/bin/chown root:root /var/spool/mail ${pkgs.coreutils}/bin/chmod a+rwxt /var/spool/mail - ln -sf ${pkgs.postfix}/share/postfix/conf/* /var/postfix/conf + ln -sf "${pkgs.postfix}/share/postfix/conf/"* /var/postfix/conf ln -sf ${aliasesFile} /var/postfix/conf/aliases ln -sf ${virtualFile} /var/postfix/conf/virtual @@ -355,11 +346,11 @@ in ${pkgs.postfix}/sbin/postalias -c /var/postfix/conf /var/postfix/conf/aliases ${pkgs.postfix}/sbin/postmap -c /var/postfix/conf /var/postfix/conf/virtual - exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start - ''; # */ + ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start + ''; preStop = '' - exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf stop + ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf stop ''; };