dovecot: use marker option as unit name migration indicator
In nixpkgs we expose `services.dovecot.hasNewUnitName` option that can be safely inspected to understand that whether to use the `dovecot` systemd service name instead of `dovecot2`.
This commit is contained in:
parent
6004878dc6
commit
d6d2053b80
7 changed files with 89 additions and 45 deletions
|
@ -16,22 +16,24 @@
|
|||
|
||||
{
|
||||
config,
|
||||
options,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with (import ./common.nix { inherit config pkgs lib; });
|
||||
with (import ./common.nix {
|
||||
inherit
|
||||
config
|
||||
options
|
||||
pkgs
|
||||
lib
|
||||
;
|
||||
});
|
||||
|
||||
let
|
||||
cfg = config.mailserver;
|
||||
|
||||
dovecotPreStart =
|
||||
''
|
||||
${genPasswdScript}
|
||||
''
|
||||
+ (lib.optionalString cfg.ldap.enable setPwdInLdapConfFile);
|
||||
|
||||
passwdDir = "/run/dovecot2";
|
||||
passwdFile = "${passwdDir}/passwd";
|
||||
userdbFile = "${passwdDir}/userdb";
|
||||
|
@ -445,10 +447,13 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
systemd.services.dovecot.preStart = lib.mkIf (config.systemd.services ? "dovecot") dovecotPreStart;
|
||||
systemd.services.dovecot2.preStart = lib.mkIf (
|
||||
config.systemd.services ? "dovecot2"
|
||||
) dovecotPreStart;
|
||||
systemd.services.${dovecotUnitName} = {
|
||||
preStart =
|
||||
''
|
||||
${genPasswdScript}
|
||||
''
|
||||
+ (lib.optionalString cfg.ldap.enable setPwdInLdapConfFile);
|
||||
};
|
||||
|
||||
systemd.services.postfix.restartTriggers = [
|
||||
genPasswdScript
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue