dovecot: fix check for dovecot systemd unit name
and migrate the preStart script in systemd.nix as well.
This commit is contained in:
parent
a40574beb5
commit
f9a52ca4b5
2 changed files with 32 additions and 26 deletions
|
@ -16,7 +16,6 @@
|
|||
|
||||
{
|
||||
config,
|
||||
options,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
|
@ -27,7 +26,11 @@ with (import ./common.nix { inherit config pkgs lib; });
|
|||
let
|
||||
cfg = config.mailserver;
|
||||
|
||||
dovecotUnitName = if lib.hasAttr "dovecot" options.systemd.services then "dovecot" else "dovecot2";
|
||||
dovecotPreStart =
|
||||
''
|
||||
${genPasswdScript}
|
||||
''
|
||||
+ (lib.optionalString cfg.ldap.enable setPwdInLdapConfFile);
|
||||
|
||||
passwdDir = "/run/dovecot2";
|
||||
passwdFile = "${passwdDir}/passwd";
|
||||
|
@ -442,11 +445,10 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
systemd.services.${dovecotUnitName}.preStart =
|
||||
''
|
||||
${genPasswdScript}
|
||||
''
|
||||
+ (lib.optionalString cfg.ldap.enable setPwdInLdapConfFile);
|
||||
systemd.services.dovecot.preStart = lib.mkIf (config.systemd.services ? "dovecot") dovecotPreStart;
|
||||
systemd.services.dovecot2.preStart = lib.mkIf (
|
||||
config.systemd.services ? "dovecot2"
|
||||
) dovecotPreStart;
|
||||
|
||||
systemd.services.postfix.restartTriggers = [
|
||||
genPasswdScript
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue