From 642814736c2f81bee106d4314a07024b36d6d633 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Mon, 16 Mar 2020 22:31:13 +0800 Subject: [PATCH] mail: go away from afew --- configs/workhorse/mail-fetcher.nix | 903 +++++++++++++++-------------- system/desktop/mail-stuff.nix | 210 +------ 2 files changed, 462 insertions(+), 651 deletions(-) diff --git a/configs/workhorse/mail-fetcher.nix b/configs/workhorse/mail-fetcher.nix index a9d35e6..8b7db94 100644 --- a/configs/workhorse/mail-fetcher.nix +++ b/configs/workhorse/mail-fetcher.nix @@ -1,5 +1,451 @@ # fetches mails for me -{ lib, pkgs, config, ... }: { +{ lib, pkgs, config, ... }: +let + filters = [ + { + query = "from:linkedin.com"; + tags = [ "+linked" "+jobs" ]; + } + { + query = "from:computerfutures.com OR from:computerfutures.de"; + tags = [ "+jobs" "-inbox" ]; + } + { + query = "from:seek.com.au or from:seek.co.nz"; + tags = [ "+jobs" ]; + } + { + query = "from:xing.com"; + tags = [ "+jobs" "-inbox" ]; + } + { + query = "from:no-reply@backtrace.io"; + tags = [ "+sononym" "-inbox" "-unread" ]; + } + { + query = "from:ebay.com OR from:ebay.de OR from:ebay.net"; + tags = [ "+ebay" "+shop" "+billing" ]; + } + { + query = "from:bahn.de"; + tags = [ "+billing" "+bahn" ]; + } + { + query = + "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:landr.com"; + tags = [ "+landr" "+music" ]; + } + { + 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" ]; + } + { + query = "from:campact.de"; + tags = [ "+campact" "+politics" ]; + } + { + query = "from:menospese.com"; + tags = [ "+junk" "-unread" "-inbox" ]; + } + { + query = "from:aliexpress.com"; + tags = [ "+shop" "+aliexpress" ]; + } + { + 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 )"; + tags = [ "-inbox" "-unread" ]; + } + { + query = + "from:steampowered.com AND ( subject:purchase OR subject:received )"; + tags = [ "+billing" "+steam" ]; + } + { + query = "from:gog.com AND NOT subject:Bestellung"; + tags = [ "-inbox" "-unread" ]; + } + { + query = "from:gog.com AND subject:Bestellung"; + tags = [ "+billing" "+gog" ]; + } + { + query = "from:drive-now.com"; + tags = [ "+billing" "+drivenow" "-inbox" "-unread" ]; + } + { + query = "from:tinc-vpn.org"; + tags = [ "+tinc" ]; + } + { + query = "from:mindfactory.de"; + tags = [ "+shop" "+billing" ]; + } + { + query = "from:zalando.de"; + tags = [ "+shop" "+billing" "+zalando" ]; + } + { + query = "from:ing.de"; + tags = [ "+bank" "+ingdiba" ]; + } + { + query = "from:nab.com.au"; + tags = [ "+bank" "+nab" "-inbox" "-unread" ]; + } + { + query = "from:dkb.de"; + tags = [ "+bank" "+dkb" ]; + } + { + query = "from:o2online.de"; + tags = [ "+billing" "+o2" ]; + } + { + query = "from:betfair.com"; + tags = [ "+work" "+betfair" ]; + } + { + query = "from:ghostinspector.com"; + tags = [ "-unread" "-inbox" "+junk" ]; + } + { + query = "from:notifications@github.com"; + tags = [ "+github" ]; + } + { + query = "from:travis-ci.org AND subject:mrVanDalo/navi"; + tags = [ "+development" "+navi" ]; + } + { + query = "from:travis-ci.org AND subject:nur-packages"; + tags = [ "+development" "+nixos" "+nur-packages" ]; + } + { + query = "from:travis-ci.org AND subject:csv-to-qif"; + tags = [ "+development" "+csv-to-qif" ]; + } + { + query = "to:proaudio@lists.tuxfamily.org"; + tags = [ "-inbox" "-unread" ]; + } + { + query = "from:nixos1@discoursemail.com"; + tags = [ "+nixos" "+discourse" ]; + } + { + query = "from:nixos1@discoursemail.com AND subject:Development"; + tags = [ "+nixos" "+discourse" "+development" ]; + } + { + query = "from:nixos1@discoursemail.com AND subject:Français"; + tags = [ "+nixos" "+discourse" "-inbox" "-unread" ]; + } + { + query = "from:nixos1@discoursemail.com AND subject:Announcements"; + tags = [ "+nixos" "+discourse" "+announcements" ]; + } + { + query = "from:nixos1@discoursemail.com AND subject:Links"; + tags = [ "+nixos" "+discourse" "+links" ]; + } + { + query = "from:nixos1@discoursemail.com AND subject:Games"; + tags = [ "+nixos" "+discourse" "+games" ]; + } + { + query = "from:nixos1@discoursemail.com AND subject:Meta"; + tags = [ "+nixos" "+discourse" "+meta" ]; + } + { + query = "from:nixos1@discoursemail.com AND subject:Events"; + tags = [ "+nixos" "+discourse" "+events" ]; + } + { + query = "from:limebike.com AND (subject:Funds OR subject:Receipt)"; + tags = [ "-inbox" "-unread" "+billing" "+limebike" ]; + } + { + query = "from:freemusicarchive.org"; + tags = [ "+FMA" ]; + } + { + query = "from:namecheap.com and subject:auto-renewal"; + tags = [ "+namecheap" "+billing" ]; + } + { + query = "from:namecheap.com and subject:order"; + tags = [ "+namecheap" "+billing" ]; + } + { + query = "tag:namecheap.com and tag:billing and body:gaykraft.com"; + tags = [ "+namecheap" "+billing" ]; + } + { + query = "from:nintendo.com"; + tags = [ "+nintendo" "+billing" ]; + } + { + 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" ]; + } + { + query = "from:sixt.de"; + tags = [ "-inbox" "-unread" ]; + } + { + query = "from:meetup.com"; + tags = [ "-inbox" "-unread" "+meetup" ]; + } + { + query = "from:slack.com"; + tags = [ "+slack" ]; + } + { + 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" ]; + } + { + query = "to:c-base.org"; + tags = [ "+cbase" ]; + } + { + query = "to:c-base.org AND subject=[auto-report]"; + tags = [ "-unread" "-inbox" ]; + } + { + query = "from:browserstack.com"; + tags = [ "+browserstack" ]; + } + { + query = + "to:renoise@ingolf-wagner.de OR to:root@renoise.com OR from:renoise.com OR to:admin@renoise.com"; + tags = [ "+renoise" ]; + } + { + query = "from:amazon.de OR from:amazon.com AND NOT to:renoise.com"; + tags = [ "+shop" "+amazon" "+billing" ]; + } + { + query = "from:hetzner.com OR from:hetzner.de"; + tags = [ "+hetzner" ]; + } + { + query = + "to:renoise.com AND NOT ( from:renoise.com OR from:root OR from:hetzner.com OR from:hetzner.de OR from:amazon.com OR from:gmail.com )"; + tags = [ "-inbox" "-unread" "+junk" "+renoise" ]; + } + { + query = "tag:hetzner and subject:Invoice"; + tags = [ "+billing" ]; + } + # final rules to make imap sync stuff easier + # there can only be one output folder tag, and theses rules are prioritized + { + query = "tag:fraud"; + tags = [ "-inbox" "-archive" "-junk" "-unread" ]; + message = "clean up tag fraud"; + } + { + query = "tag:junk"; + tags = [ "-inbox" "-archive" "-fraud" "-unread" ]; + message = "clean up tag junk"; + } + { + query = "tag:archive"; + tags = [ "-inbox" "-junk" "-fraud" "-unread" ]; + message = "clean up tag archive"; + } + { + query = "tag:inbox"; + tags = [ "-archive" "-junk" "-fraud" ]; + message = "clean up inbox"; + } + { + query = "tag:killed"; + tags = [ "-inbox" "-unread" ]; + message = "clean up tag killed"; + } + { + query = "tag:muted"; + tags = [ "-inbox" "-unread" ]; + } + # remove new tag at the end + { + query = "tag:new"; + tags = [ "-new" ]; + message = "remove new tag at the end"; + } + + ]; + + notmuchTagging = let + template = index: + { tags, query, message ? "generic", ... }: + let + command = '' + ${pkgs.notmuch}/bin/notmuch tag ${ + lib.concatStringsSep " " tags + } -- "${query}" + ''; + in '' + echo '${command}' + ${command} + ''; + in pkgs.writers.writeBash "notmuch-tagging" + (lib.concatStringsSep "\n" (lib.imap0 template filters)); + + notmuchTaggingNew = let + template = index: + { tags, query, message ? "generic", ... }: + let + command = '' + ${pkgs.notmuch}/bin/notmuch tag ${ + lib.concatStringsSep " " tags + } -- "${query} AND tag:new" + ''; + in '' + echo '${command}' + ${command} + ''; + in pkgs.writers.writeBash "notmuch-tagging-new" + (lib.concatStringsSep "\n" (lib.imap0 template filters)); + +in { backup.all.restic.dirs = [ config.users.users.mailUser.home ]; @@ -93,47 +539,6 @@ }; notmuch.enable = true; }; - #gaykraft = { - # primary = false; - # address = "root@gaykraft.com"; - # aliases = [ ]; - # realName = "Ingolf Wagner"; - # userName = "root@gaykraft.com"; - # passwordCommand = "cat ${toString config.krops.userKeys."gaykraft.root".target}"; - # imap = { - # host = "mail.gaykraft.com"; - # port = 993; - # tls.certificatesFile = - # pkgs.writeText "gaykraft.pem" '' - # -----BEGIN CERTIFICATE----- - # MIIDfzCCAmcCFBMAAMjIQnhYR9w+KIlfG8zLhM06MA0GCSqGSIb3DQEBCwUAMH8x - # CzAJBgNVBAYTAlVLMRUwEwYDVQQIDAxXYXJ3aWNrc2hpcmUxEzARBgNVBAcMCkxl - # YW1pbmd0b24xEDAOBgNVBAoMB09yZ05hbWUxHDAaBgNVBAsME1NlY3VyaXR5IERl - # cGFydG1lbnQxFDASBgNVBAMMC2V4YW1wbGUuY29tMB4XDTE5MTEyNzAxNTU1NloX - # DTE5MTEyODAxNTU1NloweTELMAkGA1UEBhMCVUsxFTATBgNVBAgMDFdhcndpY2tz - # aGlyZTETMBEGA1UEBwwKTGVhbWluZ3RvbjEQMA4GA1UECgwHT3JnTmFtZTEWMBQG - # A1UECwwNSVQgRGVwYXJ0bWVudDEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0G - # CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAJwAMze7u3I3D2z2cT7IrBeyDHfdu - # 5kCK9jZbYoU4wT7kNz/hD3BVe8BvUSNAEVJk/oPaE6v5PuFT2hAasoOhEEEr5Tt4 - # xp1MRItjxu+SUs7uZ+LpocZC4NNGb6/LPcmgthC4w8jj/JtZmcoStFqAAOqkdb6d - # tuf5lYHPxdFKRw2wgc/4pQo2PeeWder8NFoILC7Yh12zab7H2camobbbJl4tZPvJ - # z1FBk0WfeZLsUZ+2tdtginTOszsjPngygsUdQVnxfQeWBkVFXcZTHg/fELaW5uwV - # E4WIE5PZASlVwYV+gRqwM0312VW8zGF/JnwMT9hlcA27mwLBK8C4KoxRAgMBAAEw - # DQYJKoZIhvcNAQELBQADggEBAIBWcdnQbRdgxI3DXCi+IY+u+0nGrt/dduDzSqlt - # y0AFpRat4CImtgaG0jb7BDDEWTCycYFB+ABqUovQcJ5jjR/aq8Rfj2QD3nqIButg - # PyQvyYn5Z5Rx6h9aF7IOu5Eo/r/a73zJXK6iOLoLhD/e2mSIsNCW8hfbSLgPdEHH - # S14BxfacU0u1Pyh1WNprZ0C1HkJPJ/A0MZYRy4bJ5tYSO+ddcmYHbj8/ds728i8U - # L6/ijQaZ0q+lO/IXUFYODLkRcFAitg3fp/rj6D0lRMGlZKdMgI1OT6ziZm/Y074I - # yRo1wgUnGy6BOCZeHnZ9xa/q6huv9QZZGt6VtQFgnKpNNOY= - # -----END CERTIFICATE----- - # ''; - # }; - # mbsync = { - # enable = true; - # create = "both"; - # }; - # notmuch.enable = true; - #}; pali_palo = { primary = false; address = "pali_palo@web.de"; @@ -241,30 +646,8 @@ readAll = false; mailboxes = [ "ALL" ]; }; - #mbsync = { - # enable = true; - # create = "both"; - #}; notmuch.enable = true; }; - #ingolf-wagner = { - # primary = false; - # address = "contact@ingolf-wagner.de"; - # aliases = [ ]; - # realName = "Ingolf Wagner"; - # userName = "contact@ingolf-wagner.de"; - # passwordCommand = "cat ${toString config.krops.userKeys."siteground.contact".target}"; - # imap = { - # host = "securees5.sgcpanel.com"; - # port = 143; - # tls.useStartTls = true; - # }; - # mbsync = { - # enable = true; - # create = "both"; - # }; - # notmuch.enable = true; - #}; }; }; @@ -277,10 +660,7 @@ serviceConfig = { User = config.users.users.mailUser.name; }; environment.NOTMUCH_CONFIG = "${config.users.users.mailUser.home}/.config/notmuch/notmuchrc"; - script = '' - echo "run afew" - ${pkgs.afew}/bin/afew --all --tag - ''; + script = "${notmuchTagging}"; }; systemd.timers.retagmail = { enable = true; @@ -309,8 +689,9 @@ echo "run notmuch" ${pkgs.notmuch}/bin/notmuch new - echo "run afew" - ${pkgs.afew}/bin/afew --new --tag -v + ${notmuchTaggingNew} + echo "mute threads" + ${pkgs.notmuch}/bin/notmuch tag +muted $(${pkgs.notmuch}/bin/notmuch search --output=threads tag:muted) ''; }; systemd.timers.fetchmail = { @@ -344,387 +725,7 @@ message = ${message} ''; - filters = [ - - { - query = "from:linkedin.com"; - tags = [ "+linked" "+jobs" ]; - } - { - query = "from:computerfutures.com OR from:computerfutures.de"; - tags = [ "+jobs" "-inbox" ]; - } - { - query = "from:seek.com.au or from:seek.co.nz"; - tags = [ "+jobs" ]; - } - { - query = "from:xing.com"; - tags = [ "+jobs" "-inbox" ]; - } - - { - query = "from:no-reply@backtrace.io"; - tags = [ "+sononym" "-inbox" "-unread" ]; - } - { - query = "from:ebay.com OR from:ebay.de OR from:ebay.net"; - tags = [ "+ebay" "+shop" "+billing" ]; - } - { - query = "from:bahn.de"; - tags = [ "+billing" "+bahn" ]; - } - { - query = - "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:landr.com"; - tags = [ "+landr" "+music" ]; - } - { - 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" ]; - } - { - query = "from:campact.de"; - tags = [ "+campact" "+politics" ]; - } - { - query = "from:menospese.com"; - tags = [ "+junk" "-unread" "-inbox" ]; - } - { - query = "from:aliexpress.com"; - tags = [ "+shop" "+aliexpress" ]; - } - { - 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 )"; - tags = [ "-inbox" "-unread" ]; - } - { - query = - "from:steampowered.com AND ( subject:purchase OR subject:received )"; - tags = [ "+billing" "+steam" ]; - } - { - query = "from:gog.com AND NOT subject:Bestellung"; - tags = [ "-inbox" "-unread" ]; - } - { - query = "from:gog.com AND subject:Bestellung"; - tags = [ "+billing" "+gog" ]; - } - { - query = "from:drive-now.com"; - tags = [ "+billing" "+drivenow" "-inbox" "-unread" ]; - } - { - query = "from:tinc-vpn.org"; - tags = [ "+tinc" ]; - } - { - query = "from:mindfactory.de"; - tags = [ "+shop" "+billing" ]; - } - { - query = "from:zalando.de"; - tags = [ "+shop" "+billing" "+zalando" ]; - } - { - query = "from:ing.de"; - tags = [ "+bank" "+ingdiba" ]; - } - { - query = "from:nab.com.au"; - tags = [ "+bank" "+nab" "-inbox" "-unread" ]; - } - { - query = "from:dkb.de"; - tags = [ "+bank" "+dkb" ]; - } - { - query = "from:o2online.de"; - tags = [ "+billing" "+o2" ]; - } - { - query = "from:betfair.com"; - tags = [ "+work" "+betfair" ]; - } - { - query = "from:ghostinspector.com"; - tags = [ "-unread" "-inbox" "+junk" ]; - } - { - query = "from:travis-ci.org AND subject:csv-to-qif"; - tags = [ "+development" "+csv-to-qif" ]; - } - { - query = "to:proaudio@lists.tuxfamily.org"; - tags = [ "-inbox" "-unread" ]; - } - { - query = "from:nixos1@discoursemail.com"; - tags = [ "+nixos" "+discourse" ]; - } - { - query = "from:limebike.com AND (subject:Funds OR subject:Receipt)"; - tags = [ "-inbox" "-unread" "+billing" "+limebike" ]; - } - { - query = "from:freemusicarchive.org"; - tags = [ "+FMA" ]; - } - { - query = "from:namecheap.com and subject:auto-renewal"; - tags = [ "+namecheap" "+billing" ]; - } - { - query = "from:namecheap.com and subject:order"; - tags = [ "+namecheap" "+billing" ]; - } - { - query = "tag:namecheap.com and tag:billing and body:gaykraft.com"; - tags = [ "+namecheap" "+billing" ]; - } - { - query = "from:nintendo.com"; - tags = [ "+nintendo" "+billing" ]; - } - { - 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" ]; - } - { - query = "from:sixt.de"; - tags = [ "-inbox" "-unread" ]; - } - { - query = "from:meetup.com"; - tags = [ "-inbox" "-unread" "+meetup" ]; - } - { - query = "from:slack.com"; - tags = [ "+slack" ]; - } - { - 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" ]; - } - { - query = "to:c-base.org"; - tags = [ "+cbase" ]; - } - { - query = "to:c-base.org AND subject=[auto-report]"; - tags = [ "-unread" "-inbox" ]; - } - { - query = "from:browserstack.com"; - tags = [ "+browserstack" ]; - } - { - query = - "to:renoise@ingolf-wagner.de OR to:root@renoise.com OR from:renoise.com OR to:admin@renoise.com"; - tags = [ "+renoise" ]; - } - { - query = "from:amazon.de OR from:amazon.com AND NOT to:renoise.com"; - tags = [ "+shop" "+amazon" "+billing" ]; - } - { - query = "from:hetzner.com OR from:hetzner.de"; - tags = [ "+hetzner" ]; - } - { - query = - "to:renoise.com AND NOT ( from:renoise.com OR from:root OR from:hetzner.com OR from:hetzner.de OR from:amazon.com OR from:gmail.com )"; - tags = [ "-inbox" "-unread" "+junk" "+renoise" ]; - } - { - query = "tag:hetzner and subject:Invoice"; - tags = [ "+billing" ]; - } - # final rules to make imap sync stuff easier - # there can only be one output folder tag, and theses rules are prioritized - { - query = "tag:fraud"; - tags = [ "-inbox" "-archive" "-junk" "-unread" ]; - message = "clean up tag fraud"; - } - { - query = "tag:junk"; - tags = [ "-inbox" "-archive" "-fraud" "-unread" ]; - message = "clean up tag junk"; - } - { - query = "tag:archive"; - tags = [ "-inbox" "-junk" "-fraud" "-unread" ]; - message = "clean up tag archive"; - } - { - query = "tag:inbox"; - tags = [ "-archive" "-junk" "-fraud" ]; - message = "clean up inbox"; - } - { - query = "tag:killed"; - tags = [ "-inbox" "-unread" ]; - message = "clean up tag killed"; - } - - # remove new tag at the end - { - query = "tag:new"; - tags = [ "-new" ]; - message = "remove new tag at the end"; - } - - ]; - - in '' - # Tag mails which are mailing lists - [ListMailsFilter] - - # Tag mails as killed if the thread has been marked as "killed" - [KillThreadsFilter] - - ${concatStringsSep "\n" (imap0 template filters)} - - ''; + in concatStringsSep "\n" (imap0 template filters); }; } diff --git a/system/desktop/mail-stuff.nix b/system/desktop/mail-stuff.nix index 68054a4..62c309c 100644 --- a/system/desktop/mail-stuff.nix +++ b/system/desktop/mail-stuff.nix @@ -173,202 +173,6 @@ in { home-manager.users.mainUser.programs.msmtp.enable = true; home-manager.users.mainUser.programs.notmuch.enable = true; - # not working for some reason - # maybe update home-manager - #home-manager.users.mainUser.services.muchsync = { - # remotes = { - # server = { - # frequency = "*:0/10"; - # remote.host = "mailfetcher@sterni.private"; - # }; - # }; - #}; - - # configure astroid ui - home-manager.users.mainUser.programs.astroid = { - enable = true; - extraConfig = { startup.queries.inbox = "tag:inbox AND NOT tag:killed"; }; - externalEditor = - "${pkgs.neovim-qt}/bin/nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1"; - }; - - # configure alot - home-manager.users.mainUser.programs.alot = { - enable = true; - #name mono fg mono bg 16c fg 16c bg 256c fg 256c bg - # | | | | | | - # v v v v v v - #normal= 'bold,underline', '', 'light red, bold, underline', 'light green', 'light red, bold, underline', '#8f6' - bindings = { - envelope = { e = "edit"; }; - thread = { - r = "reply --all"; - R = "reply --all"; - g = "reply"; - h = "toggleheaders"; - }; - }; - extraConfig = '' - theme = "solarized_light_real" - auto_remove_unread = True - ask_subject = True - handle_mouse = False - initial_command = "search tag:inbox AND NOT tag:discourse" - input_timeout = 0.3 - exclude_tags = "killed" - prefer_plaintext = True - thread_indent_replies = 4 - - [tags] - [[flagged]] - translated = ⚑ - normal = ${ticks},${ticks},'light red',${ticks},'light red',${ticks} - focus = ${ticks},${ticks},'light red',${ticks},'light red',${ticks} - [[replied]] - translated = ⏎ - normal = ${ticks},${ticks},'light red',${ticks},'light red',${ticks} - focus = ${ticks},${ticks},'light red',${ticks},'light red',${ticks} - ''; - }; - - home-manager.users.mainUser.xdg.configFile."alot/themes/solarized_light_real".text = - '' - - - ############################################################################### - # SOLARIZED LIGHT - # - # colour theme for alot. © 2012 Patrick Totzke, GNU GPL3+ - # http://ethanschoonover.com/solarized - # https://github.com/pazz/alot - ############################################################################### - # - # Define mappings from solarized colour names to urwid attribute names for 16 - # and 256 colour modes. These work well assuming you use the solarized term - # colours via Xressources/Xdefaults. You might want to change this otherwise - - 16_base3 = 'dark gray' - 16_base2 = 'black' - 16_base1 = 'light green' - 16_base0 = 'yellow' - 16_base00 = 'light blue' - 16_base01 = 'light cyan' - 16_base02 = 'light gray' - 16_base03 = 'white' - 16_yellow = 'brown' - 16_orange = 'light red' - 16_red = 'dark red' - 16_magenta = 'dark magenta' - 16_violet = 'light magenta' - 16_blue = 'dark blue' - 16_cyan = 'dark cyan' - 16_green = 'dark green' - - # Use a slightly different mapping here to be able to use "bold" in 256c mode - - 256_base3 = 'dark gray' - 256_base2 = 'black' - 256_base1 = 'light green' - 256_base0 = 'yellow' - 256_base00 = 'g50' #808080 - 256_base01 = 'g52' #848484 - approximates #8a8a8a - 256_base02 = 'light gray' - 256_base03 = 'white' - 256_yellow = 'brown' - 256_orange = 'light red' - 256_red = 'dark red' - 256_magenta = 'dark magenta' - 256_violet = 'light magenta' - 256_blue = 'dark blue' - 256_cyan = '#0aa' #00afaf - 256_green = 'dark green' - - # This is the actual alot theme - [global] - footer = 'standout','default','%(16_base01)s','%(16_base2)s','%(256_base01)s','%(256_base2)s' - body = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - notify_error = 'standout','default','%(16_base3)s','%(16_red)s','%(256_base3)s','%(256_red)s' - notify_normal = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - prompt = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - tag = 'default','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' - tag_focus = 'standout','default','%(16_base3)s','%(16_yellow)s','%(256_base3)s','%(256_yellow)s' - [help] - text = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - section = 'underline','default','%(16_base01)s,underline','%(16_base2)s','%(256_base01)s,underline','%(256_base2)s' - title = 'standout','default','%(16_base01)s','%(16_base2)s','%(256_base01)s','%(256_base2)s' - [namedqueries] - line_focus = 'standout','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' - line_even = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - line_odd = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - [taglist] - line_focus = 'standout','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' - line_even = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - line_odd = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - [bufferlist] - line_focus = 'standout','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' - line_even = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - line_odd = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - [thread] - attachment = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - attachment_focus = 'underline','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' - body = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - body_focus = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base2)s' - arrow_bars = 'default','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' - arrow_heads = 'default','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' - header = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - header_key = 'default','default','%(16_magenta)s','%(16_base2)s','%(256_magenta)s','%(256_base2)s' - header_value = 'default','default','%(16_blue)s','%(16_base2)s','%(256_blue)s','%(256_base2)s' - [[summary]] - even = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - focus = 'standout','default','%(16_base3)s','%(16_yellow)s','%(256_base3)s','%(256_yellow)s' - odd = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - [envelope] - body = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - header = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - header_key = 'default','default','%(16_orange)s','%(16_base2)s','%(256_orange)s','%(256_base2)s' - header_value = 'default','default','%(16_violet)s','%(16_base2)s','%(256_violet)s','%(256_base2)s' - [search] - [[threadline]] - normal = 'default','default','%(16_base01)s','%(16_base3)s','%(256_base01)s','%(256_base3)s' - focus = 'default','default','%(16_base01)s,underline','%(16_base3)s','%(256_base01)s,underline','%(256_base3)s' - parts = mailcount,date,tags,authors,subject - [[[date]]] - normal = 'default','default','%(16_base01)s','%(16_base3)s','%(256_base01)s','%(256_base3)s' - focus = 'default','default','%(16_base01)s,underline','%(16_base3)s','%(256_base01)s,underline','%(256_base3)s' - [[[mailcount]]] - normal = 'default','default','%(16_base01)s','%(16_base3)s','%(256_base01)s','%(256_base3)s' - focus = 'default','default','%(16_base01)s,underline','%(16_base3)s','%(256_base01)s,underline','%(256_base3)s' - [[[tags]]] - normal = 'bold','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' - focus = 'bold','default','%(16_yellow)s,underline','%(16_base3)s','%(256_yellow)s,underline','%(256_base3)s' - [[[authors]]] - normal = 'default,underline','default','%(16_blue)s','%(16_base3)s','%(256_blue)s','%(256_base3)s' - focus = 'default,underline','default','%(16_blue)s,underline','%(16_base3)s','%(256_blue)s,underline','%(256_base3)s' - width = 'fit',0,30 - [[[subject]]] - normal = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - focus = 'default','default','%(16_base00)s,underline','%(16_base3)s','%(256_base00)s,underline','%(256_base3)s' - width = 'weight',1 - [[[content]]] - normal = 'default','default','%(16_base1)s','%(16_base3)s','%(256_base1)s','%(256_base3)s' - focus = 'default','default','%(16_base1)s,underline','%(16_base3)s','%(256_base1)s,underline','%(256_base3)s' - [[threadline-unread]] - normal = 'default','default','%(16_base01)s,bold','%(16_base2)s','%(256_base01)s,bold','%(256_base2)s' - tagged_with = 'unread' - [[[date]]] - normal = 'default','default','%(16_base01)s,bold','%(16_base2)s','%(256_base01)s,bold','%(256_base2)s' - [[[mailcount]]] - normal = 'default','default','%(16_base01)s,bold','%(16_base2)s','%(256_base01)s,bold','%(256_base2)s' - [[[tags]]] - normal = 'bold','default','%(16_yellow)s','%(16_base2)s','%(256_yellow)s','%(256_base2)s' - [[[authors]]] - normal = 'default,underline','default','%(16_violet)s','%(16_base2)s','%(256_violet)s','%(256_base2)s' - [[[subject]]] - normal = 'default','default','%(16_base02)s,bold','%(16_base2)s','%(256_base02)s,bold','%(256_base2)s' - [[[content]]] - normal = 'default','default','%(16_base1)s,bold','%(16_base2)s','%(256_base1)s,bold','%(256_base2)s' - ''; - # enable html emails home-manager.users.mainUser.home.file.".mailcap".text = '' text/html; ${pkgs.elinks}/bin/elinks -dump ; copiousoutput; @@ -428,9 +232,15 @@ in { '' } %r |" - virtual-mailboxes "INBOX" "notmuch://?query=(tag:inbox or (tag:sent and not tag:archive)) AND NOT tag:discourse" - virtual-mailboxes "Unread" "notmuch://?query=tag:unread" - virtual-mailboxes "Discourse" "notmuch://?query=tag:discourse" + virtual-mailboxes "INBOX" "notmuch://?query=(tag:inbox or (tag:sent and not tag:archive)) AND NOT tag:discourse AND NOT tag:muted" + virtual-mailboxes "Unread" "notmuch://?query=(tag:unread AND NOT tag:muted)" + virtual-mailboxes "Discourse.all" "notmuch://?query=(tag:discourse AND NOT tag:muted)" + virtual-mailboxes "Discourse.development" "notmuch://?query=(tag:discourse AND tag:development AND NOT tag:muted)" + virtual-mailboxes "Discourse.announcements" "notmuch://?query=(tag:discourse AND tag:announcements AND NOT tag:muted)" + virtual-mailboxes "Discourse.links" "notmuch://?query=(tag:discourse AND tag:links AND NOT tag:muted)" + virtual-mailboxes "Discourse.games" "notmuch://?query=(tag:discourse AND tag:games AND NOT tag:muted)" + virtual-mailboxes "Discourse.meta" "notmuch://?query=(tag:discourse AND tag:meta AND NOT tag:muted)" + virtual-mailboxes "Discourse.events" "notmuch://?query=(tag:discourse AND tag:events AND NOT tag:muted)" virtual-mailboxes "Starred" "notmuch://?query=tag:flagged" virtual-mailboxes "Archive" "notmuch://?query=tag:archive" virtual-mailboxes "Sent" "notmuch://?query=tag:sent" @@ -440,7 +250,7 @@ in { tag-transforms "junk" "k" \ "unread" "u" \ "replied" "↻" \ - "TODO" "T" \ + "TODO" "T" # notmuch bindings bind index \\\\ noop