From e0736b06a2195bb1c4db8ee74246d4d07a9c286e Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sun, 5 Sep 2021 12:32:49 +0200 Subject: [PATCH] add junk filters --- configs/sputnik/nginx.nix | 2 - configs/workhorse/mail-fetcher.nix | 166 ++++++++--------------------- system/desktop/mail-stuff.nix | 2 +- 3 files changed, 47 insertions(+), 123 deletions(-) diff --git a/configs/sputnik/nginx.nix b/configs/sputnik/nginx.nix index 1c95e13..3d36729 100644 --- a/configs/sputnik/nginx.nix +++ b/configs/sputnik/nginx.nix @@ -221,8 +221,6 @@ in { } // error.locations; }; - - "terranix.org" = { listen = [ { diff --git a/configs/workhorse/mail-fetcher.nix b/configs/workhorse/mail-fetcher.nix index d89e08a..3c27e1a 100644 --- a/configs/workhorse/mail-fetcher.nix +++ b/configs/workhorse/mail-fetcher.nix @@ -1,6 +1,42 @@ # fetches mails for me { lib, pkgs, config, ... }: let + junk_filter = [ + "from:booking.com" + "from:brompton.com" + "from:circleci.com OR (from:noreply@github.com AND to:audio-overlay@googlegroups.com)" + "from:codepen.io" + "from:congstarnews.de" + "from:cryptohopper.com" + "from:digitalo.de" + "from:facebook.com OR from:facebookmail.com" + "from:fitnessfirst.de" + "from:flixbus.de" + "from:getdigital.de" + "from:getpocket.com" + "from:ghostinspector.com" + "from:hackster.io" + "from:immobilienscout24.de" + "from:letterboxd.com" + "from:magix.net" + "from:mailings.gmx.net" + "from:mailings.web.de" + "from:matrix.org" + "from:menospese.com" + "from:microsoftstoreemail.com" + "from:mixcloudmail.com AND subject:Weekly Update" + "from:oknotify2.com AND NOT subject:New message" + "from:paulaschoice.com" + "from:puppet.com" + "from:runtastic.com" + "from:samplemagic.com OR from:wavealchemy.co.uk OR from:creators.gumroad.com" + "from:ticketmaster.de" + "from:trade4less.de" + "from:tumblr.com" + "from:turners.co.nz" + "from:twitch.tv" + "from:vstbuzz.com" + ]; filters = [ { query = "from:linkedin.com"; @@ -35,14 +71,6 @@ let "from:fysitech.atlassian.net OR to:engiadina-pwa@noreply.github.com"; tags = [ "+mia" "+work" "-unread" "-inbox" ]; } - { - query = "from:turners.co.nz"; - tags = [ "+junk" "-unread" "-inbox" ]; - } - { - query = "from:twitch.tv"; - tags = [ "+junk" "-unread" "-inbox" ]; - } { query = "from:space-left.org OR to:space-left.org OR subject:/\\[space-left\\]/"; @@ -56,80 +84,10 @@ let query = "tag:landr and tag:billing"; tags = [ "+billing" ]; } - { - query = "from:codepen.io"; - tags = [ "+junk" "-unread" "-inbox" ]; - } - { - query = "from:mailings.web.de"; - tags = [ "+junk" "-unread" "-inbox" ]; - } - { - query = - "from:circleci.com OR (from:noreply@github.com AND to:audio-overlay@googlegroups.com)"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:getdigital.de"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:digitalo.de"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:puppet.com"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:mixcloudmail.com AND subject:Weekly Update"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:facebook.com OR from:facebookmail.com"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:getpocket.com"; - tags = [ "-inbox" "-unread" "+junk" ]; - } { query = "from:oknotify2.com"; tags = [ "+okcupid" ]; } - { - query = "from:oknotify2.com AND NOT subject:New message"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:paulaschoice.com"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = - "from:samplemagic.com OR from:wavealchemy.co.uk OR from:creators.gumroad.com"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:immobilienscout24.de"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:magix.net"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:booking.com"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:hackster.io"; - tags = [ "-inbox" "-unread" "+junk" ]; - } - { - query = "from:trade4less.de"; - tags = [ "-inbox" "-unread" "+junk" ]; - } { query = "from:taxback.de OR to:taxback.de"; tags = [ "+steuer" ]; @@ -138,10 +96,6 @@ let query = "from:campact.de"; tags = [ "+campact" "+politics" ]; } - { - query = "from:menospese.com"; - tags = [ "+junk" "-unread" "-inbox" ]; - } { query = "from:aliexpress.com"; tags = [ "+shop" "+aliexpress" ]; @@ -150,14 +104,6 @@ let query = "from:congstar.de"; tags = [ "+billing" "+congstar" "-inbox" "-unread" ]; } - { - query = "from:congstarnews.de"; - tags = [ "+congstar" "-inbox" "-unread" "+junk" ]; - } - { - query = "from:fitnessfirst.de"; - tags = [ "-inbox" "-unread" "+junk" ]; - } { query = "from:steampowered.com AND NOT ( subject:purchase OR subject:received )"; @@ -224,10 +170,6 @@ let query = "from:betfair.com"; tags = [ "+work" "+betfair" ]; } - { - query = "from:ghostinspector.com"; - tags = [ "-unread" "-inbox" "+junk" ]; - } { query = "from:notifications@github.com"; tags = [ "+github" ]; @@ -316,22 +258,6 @@ let query = "from:oculus.com AND subject:receipt"; tags = [ "+oculus" "+billing" ]; } - { - query = "from:vstbuzz.com"; - tags = [ "+junk" "-inbox" ]; - } - { - query = "from:runtastic.com"; - tags = [ "+junk" "-inbox" ]; - } - { - query = "from:letterboxd.com"; - tags = [ "+junk" "-inbox" ]; - } - { - query = "from::microsoftstoreemail.com"; - tags = [ "+junk" "-inbox" ]; - } { query = "from:car2go.com"; tags = [ "-inbox" "-unread" ]; @@ -352,18 +278,10 @@ let query = "from:keybase.io"; tags = [ "+keybase" ]; } - { - query = "from:tumblr.com"; - tags = [ "+junk" "-inbox" "-unread" ]; - } { query = "from:jobs2web.com"; tags = [ "+newzealand" "+jobs" "-inbox" ]; } - { - query = "from:mailings.gmx.net"; - tags = [ "+junk" "-inbox" "-unread" ]; - } { query = "from:paypal.de AND subject:Bestätigung"; tags = [ "-unread" "+paypal" "+billing" ]; @@ -442,6 +360,7 @@ let ]; notmuchTagging = let + template = index: { tags, query, message ? "generic", ... }: let @@ -454,8 +373,15 @@ let echo '${command}' ${command} ''; - in pkgs.writers.writeBash "notmuch-tagging" - (lib.concatStringsSep "\n" (lib.imap0 template filters)); + junk_template = index: query: + template index { + tags = [ "+junk" "-unread" "-inbox" ]; + query = query; + message = "generic junk filter"; + }; + + in pkgs.writers.writeBash "notmuch-tagging" (lib.concatStringsSep "\n" + ((lib.imap0 junk_template junk_filter) ++ (lib.imap0 template filters))); notmuchTaggingNew = let template = index: diff --git a/system/desktop/mail-stuff.nix b/system/desktop/mail-stuff.nix index 63a2bfe..369b0f9 100644 --- a/system/desktop/mail-stuff.nix +++ b/system/desktop/mail-stuff.nix @@ -108,7 +108,7 @@ in { enable = true; # msmtp --serverinfo --tls --tls-certcheck=off -a ingolf-wagner tls.fingerprint = - "F3:5C:9A:BF:82:35:78:AA:42:85:F5:D1:2A:08:B9:B4:56:6D:B7:BF:47:3B:37:B4:D8:B5:10:AE:0E:95:03:CD"; + "F3:5C:9A:BF:82:35:78:AA:42:85:F5:D1:2A:08:B9:B4:56:6D:B7:BF:47:3B:37:B4:D8:B5:10:AE:0E:95:03:CD"; }; gpg = { encryptByDefault = true;