dovecot: no longer need to copy sieve scripts

This commit is contained in:
Gaetan Lepage 2024-03-04 08:14:21 +01:00 committed by Antoine Eiche
parent fe6d325397
commit d507bd9c95

View File

@ -195,8 +195,11 @@ in
} }
''; '';
pipeBins = [ pipeBins = map lib.getExe [
pipeBin (pkgs.writeShellScriptBin "sa-learn-ham.sh"
"exec ${pkgs.rspamd}/bin/rspamc -h /run/rspamd/worker-controller.sock learn_ham")
(pkgs.writeShellScriptBin "sa-learn-spam.sh"
"exec ${pkgs.rspamd}/bin/rspamc -h /run/rspamd/worker-controller.sock learn_spam")
]; ];
}; };
@ -204,13 +207,13 @@ in
{ {
name = junkMailboxName; name = junkMailboxName;
causes = [ "COPY" "APPEND" ]; causes = [ "COPY" "APPEND" ];
before = "${stateDir}/imap_sieve/report-spam.sieve"; before = ./dovecot/imap_sieve/report-spam.sieve;
} }
{ {
name = "*"; name = "*";
from = junkMailboxName; from = junkMailboxName;
causes = [ "COPY" ]; causes = [ "COPY" ];
before = "${stateDir}/imap_sieve/report-ham.sieve"; before = ./dovecot/imap_sieve/report-ham.sieve;
} }
]; ];
@ -363,13 +366,6 @@ in
systemd.services.dovecot2 = { systemd.services.dovecot2 = {
preStart = '' preStart = ''
${genPasswdScript} ${genPasswdScript}
rm -rf '${stateDir}/imap_sieve'
mkdir '${stateDir}/imap_sieve'
cp -p "${./dovecot/imap_sieve}"/*.sieve '${stateDir}/imap_sieve/'
for k in "${stateDir}/imap_sieve"/*.sieve ; do
${pkgs.dovecot_pigeonhole}/bin/sievec "$k"
done
chown -R '${dovecot2Cfg.mailUser}:${dovecot2Cfg.mailGroup}' '${stateDir}/imap_sieve'
'' + (lib.optionalString cfg.ldap.enable setPwdInLdapConfFile); '' + (lib.optionalString cfg.ldap.enable setPwdInLdapConfFile);
}; };