From 4550aade4922f66b5f95f687731431f605b97d2a Mon Sep 17 00:00:00 2001 From: niten Date: Fri, 13 Oct 2023 15:48:35 -0700 Subject: [PATCH] Fuck it, switch to Xapian --- dovecot.nix | 40 ++++++++++++++++++---------------------- mail-server.nix | 5 ++--- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/dovecot.nix b/dovecot.nix index 83a893b..1da7143 100644 --- a/dovecot.nix +++ b/dovecot.nix @@ -217,9 +217,6 @@ in { }; }; - # FIXME: TEMPORARY FOR TESTING - environment.systemPackages = with pkgs; [ openldap ]; - systemd = { tmpfiles.rules = [ "d ${cfg.state-directory} 0711 root root - -" @@ -252,7 +249,7 @@ in { serviceConfig = { ExecStart = "${pkgs.curl}/bin/curl http://${cfg.solr.host}:${ toString cfg.solr.port - }/?${params}"; + }/solr/dovecot/update?${params}"; PrivateDevices = true; PrivateTmp = true; PrivateMounts = true; @@ -351,10 +348,16 @@ in { mailboxes = cfg.mailboxes; - modules = with pkgs; [ dovecot_pigeonhole ]; + modules = with pkgs; [ dovecot_pigeonhole dovecot_fts_xapian ]; protocols = [ "sieve" ]; - mailPlugins.globally.enable = [ "old_stats" "fts" "fts_solr" ]; + mailPlugins = { + globally.enable = [ "old_stats" "fts" "fts_xapian" ]; + perProtocol = { + imap = [ "imap_sieve" "fts" "fts_xapian" ]; + lmtp = [ "sieve" "fts" "fts_xapian" ]; + }; + }; sieveScripts = { after = builtins.toFile "spam.sieve" '' @@ -398,25 +401,18 @@ in { verbose_ssl = yes ''} - protocol imap { - mail_max_userip_connections = ${toString cfg.max-user-connections} - mail_plugins = $mail_plugins imap_sieve fts fts_solr - } - - protocol lmtp { - mail_plugins = $mail_plugins sieve fts fts_solr - } - plugin { - fts = solr - fts_solr = url=http://${cfg.solr.host}:${ - toString cfg.solr.port - }/solr/dovecot ${optionalString cfg.debug "debug"} + fts = xapian + fts_xapian = partial=3 full=20 ${optionalString cfg.debug "verbose"} fts_autoindex = yes - fts_autoindex_exclude = \Junk - fts_autoindex_exclude = \Trash - fts_decoder = decode2text fts_enforced = yes + fts_autoindex_exclude = \Trash + fts_autoindex_exclude = \Junk + fts_decoder = decode2text + } + + service indexer-worker { + vsz_limit = 0 } mail_access_groups = ${cfg.mail-group} diff --git a/mail-server.nix b/mail-server.nix index 0b22966..74d9764 100644 --- a/mail-server.nix +++ b/mail-server.nix @@ -434,9 +434,8 @@ in { image = cfg.images.solr; restart = "always"; networks = [ "solr_network" ]; - volumes = - [ "${cfg.state-directory}/solr:/opt/solr/server/solr/dovecot" ]; - user = "${toString config.users.users.mail-server-solr.uid}:8983"; + volumes = [ "${cfg.state-directory}/solr:/var/solr" ]; + #user = "${toString config.users.users.mail-server-solr.uid}:8983"; }; antispam = { service = {