From 9f90c1643ac017e7b78c29f3e11cc4509c8d576d Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Sun, 3 Sep 2023 22:30:56 +0200 Subject: [PATCH] enable spam training --- flake.lock | 24 +++++++------- hosts/falkenstein-1/modules/mail/default.nix | 35 +++++++++++++++++++- users/rouven/modules/packages.nix | 1 + users/rouven/modules/wayland/waybar.nix | 6 ++-- 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index a174451..da5d6fb 100644 --- a/flake.lock +++ b/flake.lock @@ -255,11 +255,11 @@ ] }, "locked": { - "lastModified": 1693399033, - "narHash": "sha256-yXhiMo8MnE86sGtPIHAKaLHhmhe8v9tqGGotlUgKJvY=", + "lastModified": 1693713564, + "narHash": "sha256-00w2uwb4O6Y1e2W5LG5UFyl1ZN3KFG7aoRdYEvT/BqA=", "owner": "nix-community", "repo": "home-manager", - "rev": "f5c15668f9842dd4d5430787d6aa8a28a07f7c10", + "rev": "8e49b883890ccb52c059abb152b00a416342ec1c", "type": "github" }, "original": { @@ -356,11 +356,11 @@ ] }, "locked": { - "lastModified": 1693107069, - "narHash": "sha256-5dVXPchyvzmytanlwXHcmeQP9AfO/98Q6V+QtsMl5vQ=", + "lastModified": 1693711723, + "narHash": "sha256-5QmlVzskLciJ0QzYmZ6ULvKA7bP6pgV9wwrLBB0V3j0=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "53d40cf1bea235658ef8f6e8b8a1d033e2ecbfff", + "rev": "aca56a79afb82208af2b39d8459dd29c10989135", "type": "github" }, "original": { @@ -371,11 +371,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1692952286, - "narHash": "sha256-TsrtPv3+Q1KR0avZxpiJH+b6fX/R/hEQVHbjl1ebotY=", + "lastModified": 1693718952, + "narHash": "sha256-+nGdJlgTk0MPN7NygopipmyylVuAVi7OItIwTlwtGnw=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "817e297fc3352fadc15f2c5306909aa9192d7d97", + "rev": "793de77d9f83418b428e8ba70d1e42c6507d0d35", "type": "github" }, "original": { @@ -448,11 +448,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1693377291, - "narHash": "sha256-vYGY9bnqEeIncNarDZYhm6KdLKgXMS+HA2mTRaWEc80=", + "lastModified": 1693663421, + "narHash": "sha256-ImMIlWE/idjcZAfxKK8sQA7A1Gi/O58u5/CJA+mxvl8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e7f38be3775bab9659575f192ece011c033655f0", + "rev": "e56990880811a451abd32515698c712788be5720", "type": "github" }, "original": { diff --git a/hosts/falkenstein-1/modules/mail/default.nix b/hosts/falkenstein-1/modules/mail/default.nix index 86571e9..88d7cd4 100644 --- a/hosts/falkenstein-1/modules/mail/default.nix +++ b/hosts/falkenstein-1/modules/mail/default.nix @@ -26,6 +26,22 @@ in description = "Rouven Seifert"; isNormalUser = true; }; + environment.etc = { + "dovecot/sieve-pipe/sa-learn-spam.sh" = { + text = '' + #!/bin/sh + ${pkgs.rspamd}/bin/rspamc learn_spam + ''; + mode = "0555"; + }; + "dovecot/sieve-pipe/sa-learn-ham.sh" = { + text = '' + #!/bin/sh + ${pkgs.rspamd}/bin/rspamc learn_ham + ''; + mode = "0555"; + }; + }; services = { postfix = { @@ -95,7 +111,7 @@ in mailPlugins = { perProtocol = { imap = { - enable = [ ]; + enable = [ "imap_sieve" ]; }; lmtp = { enable = [ "sieve" ]; @@ -151,6 +167,23 @@ in } client_limit = 1 } + + plugin { + sieve_plugins = sieve_imapsieve sieve_extprograms + sieve_global_extensions = +vnd.dovecot.pipe + sieve_pipe_bin_dir = /etc/dovecot/sieve-pipe + + # Spam: From elsewhere to Spam folder or flag changed in Spam folder + imapsieve_mailbox1_name = Spam + imapsieve_mailbox1_causes = COPY APPEND FLAG + imapsieve_mailbox1_before = file:/var/lib/dovecot/imap_sieve/report-spam.sieve + + # Ham: From Spam folder to elsewhere + imapsieve_mailbox2_name = * + imapsieve_mailbox2_from = Spam + imapsieve_mailbox2_causes = COPY + imapsieve_mailbox1_before = file:/var/lib/dovecot/imap_sieve/report-ham.sieve + } ''; }; diff --git a/users/rouven/modules/packages.nix b/users/rouven/modules/packages.nix index b3c5ba3..cabe51e 100644 --- a/users/rouven/modules/packages.nix +++ b/users/rouven/modules/packages.nix @@ -71,6 +71,7 @@ programs.texlive.enable = true; programs.obs-studio.enable = true; + programs.firefox.enable = true; xdg.mimeApps = { enable = true; diff --git a/users/rouven/modules/wayland/waybar.nix b/users/rouven/modules/wayland/waybar.nix index acd3b9e..cd758f5 100644 --- a/users/rouven/modules/wayland/waybar.nix +++ b/users/rouven/modules/wayland/waybar.nix @@ -12,7 +12,7 @@ height = 26; # modules-left = [ "wlr/workspaces" "custom/spotifytitle" "hyprland/window" ]; modules-left = [ "river/tags" "custom/spotifytitle" "river/window" ]; - modules-right = [ "network" "cpu" "temperature" "pulseaudio" "battery" "tray" "custom/notification" "clock" ]; + modules-right = [ "network" "cpu" "pulseaudio" "battery" "tray" "custom/notification" "clock" ]; network = { format-wifi = " {essid} ({signalStrength}%)"; format-ethernet = "󰈀 {ipaddr}/{cidr}"; @@ -192,12 +192,12 @@ } #cpu { - background-color: #${config.colorScheme.colors.base06}; + background-color: #${config.colorScheme.colors.base05}; color: #${config.colorScheme.colors.base01}; } #network { - background-color: #${config.colorScheme.colors.base07}; + background-color: #${config.colorScheme.colors.base06}; color: #${config.colorScheme.colors.base01}; }