add junk filters

This commit is contained in:
Ingolf Wagner 2021-09-05 12:32:49 +02:00
parent 28dcbadc8e
commit e0736b06a2
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 47 additions and 123 deletions

View file

@ -221,8 +221,6 @@ in {
} // error.locations; } // error.locations;
}; };
"terranix.org" = { "terranix.org" = {
listen = [ listen = [
{ {

View file

@ -1,6 +1,42 @@
# fetches mails for me # fetches mails for me
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
let 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 = [ filters = [
{ {
query = "from:linkedin.com"; query = "from:linkedin.com";
@ -35,14 +71,6 @@ let
"from:fysitech.atlassian.net OR to:engiadina-pwa@noreply.github.com"; "from:fysitech.atlassian.net OR to:engiadina-pwa@noreply.github.com";
tags = [ "+mia" "+work" "-unread" "-inbox" ]; tags = [ "+mia" "+work" "-unread" "-inbox" ];
} }
{
query = "from:turners.co.nz";
tags = [ "+junk" "-unread" "-inbox" ];
}
{
query = "from:twitch.tv";
tags = [ "+junk" "-unread" "-inbox" ];
}
{ {
query = query =
"from:space-left.org OR to:space-left.org OR subject:/\\[space-left\\]/"; "from:space-left.org OR to:space-left.org OR subject:/\\[space-left\\]/";
@ -56,80 +84,10 @@ let
query = "tag:landr and tag:billing"; query = "tag:landr and tag:billing";
tags = [ "+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"; query = "from:oknotify2.com";
tags = [ "+okcupid" ]; 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"; query = "from:taxback.de OR to:taxback.de";
tags = [ "+steuer" ]; tags = [ "+steuer" ];
@ -138,10 +96,6 @@ let
query = "from:campact.de"; query = "from:campact.de";
tags = [ "+campact" "+politics" ]; tags = [ "+campact" "+politics" ];
} }
{
query = "from:menospese.com";
tags = [ "+junk" "-unread" "-inbox" ];
}
{ {
query = "from:aliexpress.com"; query = "from:aliexpress.com";
tags = [ "+shop" "+aliexpress" ]; tags = [ "+shop" "+aliexpress" ];
@ -150,14 +104,6 @@ let
query = "from:congstar.de"; query = "from:congstar.de";
tags = [ "+billing" "+congstar" "-inbox" "-unread" ]; tags = [ "+billing" "+congstar" "-inbox" "-unread" ];
} }
{
query = "from:congstarnews.de";
tags = [ "+congstar" "-inbox" "-unread" "+junk" ];
}
{
query = "from:fitnessfirst.de";
tags = [ "-inbox" "-unread" "+junk" ];
}
{ {
query = query =
"from:steampowered.com AND NOT ( subject:purchase OR subject:received )"; "from:steampowered.com AND NOT ( subject:purchase OR subject:received )";
@ -224,10 +170,6 @@ let
query = "from:betfair.com"; query = "from:betfair.com";
tags = [ "+work" "+betfair" ]; tags = [ "+work" "+betfair" ];
} }
{
query = "from:ghostinspector.com";
tags = [ "-unread" "-inbox" "+junk" ];
}
{ {
query = "from:notifications@github.com"; query = "from:notifications@github.com";
tags = [ "+github" ]; tags = [ "+github" ];
@ -316,22 +258,6 @@ let
query = "from:oculus.com AND subject:receipt"; query = "from:oculus.com AND subject:receipt";
tags = [ "+oculus" "+billing" ]; 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"; query = "from:car2go.com";
tags = [ "-inbox" "-unread" ]; tags = [ "-inbox" "-unread" ];
@ -352,18 +278,10 @@ let
query = "from:keybase.io"; query = "from:keybase.io";
tags = [ "+keybase" ]; tags = [ "+keybase" ];
} }
{
query = "from:tumblr.com";
tags = [ "+junk" "-inbox" "-unread" ];
}
{ {
query = "from:jobs2web.com"; query = "from:jobs2web.com";
tags = [ "+newzealand" "+jobs" "-inbox" ]; tags = [ "+newzealand" "+jobs" "-inbox" ];
} }
{
query = "from:mailings.gmx.net";
tags = [ "+junk" "-inbox" "-unread" ];
}
{ {
query = "from:paypal.de AND subject:Bestätigung"; query = "from:paypal.de AND subject:Bestätigung";
tags = [ "-unread" "+paypal" "+billing" ]; tags = [ "-unread" "+paypal" "+billing" ];
@ -442,6 +360,7 @@ let
]; ];
notmuchTagging = let notmuchTagging = let
template = index: template = index:
{ tags, query, message ? "generic", ... }: { tags, query, message ? "generic", ... }:
let let
@ -454,8 +373,15 @@ let
echo '${command}' echo '${command}'
${command} ${command}
''; '';
in pkgs.writers.writeBash "notmuch-tagging" junk_template = index: query:
(lib.concatStringsSep "\n" (lib.imap0 template filters)); 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 notmuchTaggingNew = let
template = index: template = index: