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.
This commit is contained in:
Brian Olsen 2020-06-19 16:02:21 +02:00
parent fb8886547b
commit eb70dd1f55
No known key found for this signature in database
GPG Key ID: 029DD8E8B95882E8

View File

@ -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 ];
};
}