dovecot: add compat shim for dovecot unit name migration
In nixpkgs I renamed dovecot2 to dovecot and made dovecot2 an alias, so adding the script to the alias does us no good.
This commit is contained in:
parent
b10c54606b
commit
b38dc8085c
1 changed files with 8 additions and 7 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
options,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
|
@ -26,6 +27,8 @@ with (import ./common.nix { inherit config pkgs lib; });
|
||||||
let
|
let
|
||||||
cfg = config.mailserver;
|
cfg = config.mailserver;
|
||||||
|
|
||||||
|
dovecotUnitName = if lib.hasAttr "dovecot" options.systemd.services then "dovecot" else "dovecot2";
|
||||||
|
|
||||||
passwdDir = "/run/dovecot2";
|
passwdDir = "/run/dovecot2";
|
||||||
passwdFile = "${passwdDir}/passwd";
|
passwdFile = "${passwdDir}/passwd";
|
||||||
userdbFile = "${passwdDir}/userdb";
|
userdbFile = "${passwdDir}/userdb";
|
||||||
|
@ -439,13 +442,11 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.dovecot2 = {
|
systemd.services.${dovecotUnitName}.preStart =
|
||||||
preStart =
|
''
|
||||||
''
|
${genPasswdScript}
|
||||||
${genPasswdScript}
|
''
|
||||||
''
|
+ (lib.optionalString cfg.ldap.enable setPwdInLdapConfFile);
|
||||||
+ (lib.optionalString cfg.ldap.enable setPwdInLdapConfFile);
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.postfix.restartTriggers = [
|
systemd.services.postfix.restartTriggers = [
|
||||||
genPasswdScript
|
genPasswdScript
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue