From d05bd24040a597e8cc333e301eb91be48d4f40c9 Mon Sep 17 00:00:00 2001 From: Robin Raymond Date: Wed, 23 Aug 2017 17:34:34 +0200 Subject: [PATCH] make dovecot wait for postfix instead of other way around --- mail-server/systemd.nix | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mail-server/systemd.nix b/mail-server/systemd.nix index 6ce4365..158a71d 100644 --- a/mail-server/systemd.nix +++ b/mail-server/systemd.nix @@ -60,19 +60,22 @@ in # . We choose # to use the systemd service to set the folder permissions whenever # dovecot gets started. - services.dovecot2.preStart = - '' - # Create mail directory and set permissions - mkdir -p "${mail_dir}" - chgrp "${vmail_group_name}" "${mail_dir}" - chmod 02770 "${mail_dir}" - - ${create_certificate} - ''; + services.dovecot2.after = [ "postfix.service" ]; # Check for certificate before both postfix and dovecot to make sure it # exists. - services.postfix.after = ["dovecot2.service"]; + services.postfix = { + preStart = + '' + # Create mail directory and set permissions + mkdir -p "${mail_dir}" + chgrp "${vmail_group_name}" "${mail_dir}" + chmod 02770 "${mail_dir}" + + ${create_certificate} + ''; + }; + services.opendkim = { after = ["dovecot2.service"]; preStart =