From eb70dd1f55c0013a874aa96ed53117983ebf439a Mon Sep 17 00:00:00 2001 From: Brian Olsen Date: Fri, 19 Jun 2020 16:02:21 +0200 Subject: [PATCH] Fix passwfile update Currently oneshot services are not re-run on NixOS activate and that meant that you needed to manually restart `gen-passwd-file` for new users to be available. This commit removes the `gen-passwd-file` service and instead simply calls the same script in the dovecot2 preStart. --- mail-server/dovecot.nix | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/mail-server/dovecot.nix b/mail-server/dovecot.nix index 02d5a5d..fa7a3c8 100644 --- a/mail-server/dovecot.nix +++ b/mail-server/dovecot.nix @@ -199,18 +199,9 @@ in ''; }; - systemd.services.gen-passwd-file = { - serviceConfig = { - ExecStart = genPasswdScript; - Type = "oneshot"; - }; - }; - systemd.services.dovecot2 = { - after = [ "gen-passwd-file.service" ]; - wants = [ "gen-passwd-file.service" ]; - requires = [ "gen-passwd-file.service" ]; preStart = '' + ${genPasswdScript} rm -rf '${stateDir}/imap_sieve' mkdir '${stateDir}/imap_sieve' cp -p "${./dovecot/imap_sieve}"/*.sieve '${stateDir}/imap_sieve/' @@ -221,6 +212,6 @@ in ''; }; - systemd.services.postfix.restartTriggers = [ passwdFile ]; + systemd.services.postfix.restartTriggers = [ genPasswdScript ]; }; }