From d507bd9c9571001054792dd34099fa500f4573c1 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 4 Mar 2024 08:14:21 +0100 Subject: [PATCH] dovecot: no longer need to copy sieve scripts --- mail-server/dovecot.nix | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/mail-server/dovecot.nix b/mail-server/dovecot.nix index 45c9d41..6459846 100644 --- a/mail-server/dovecot.nix +++ b/mail-server/dovecot.nix @@ -195,8 +195,11 @@ in } ''; - pipeBins = [ - pipeBin + pipeBins = map lib.getExe [ + (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; causes = [ "COPY" "APPEND" ]; - before = "${stateDir}/imap_sieve/report-spam.sieve"; + before = ./dovecot/imap_sieve/report-spam.sieve; } { name = "*"; from = junkMailboxName; causes = [ "COPY" ]; - before = "${stateDir}/imap_sieve/report-ham.sieve"; + before = ./dovecot/imap_sieve/report-ham.sieve; } ]; @@ -363,13 +366,6 @@ in systemd.services.dovecot2 = { preStart = '' ${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); };