mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat(mail): use afew as initial tagging script
This commit is contained in:
@@ -1,5 +1,26 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
|
tagRules = [
|
||||||
|
{
|
||||||
|
query = "to:miaengiadina-pwa@noreply.github.com AND subject:\"PR run failed\"";
|
||||||
|
tags = [ "-new" "+deleted" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
query = lib.concatStringsSep " OR " [
|
||||||
|
"from:noreply-local-guides@google.com"
|
||||||
|
"from:google-maps-noreply@google.com"
|
||||||
|
"subject:fd-noti"
|
||||||
|
"from:nebenan.de"
|
||||||
|
"to:miaengiadina-pwa@noreply.github.com"
|
||||||
|
];
|
||||||
|
tags = [ "-new" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
query = "tag:new";
|
||||||
|
tags = [ "-new" "+inbox" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
pass_ = file: "echo ${lib.escapeShellArg (lib.strings.fileContents file)}";
|
pass_ = file: "echo ${lib.escapeShellArg (lib.strings.fileContents file)}";
|
||||||
|
|
||||||
generateTaggingScript = filters:
|
generateTaggingScript = filters:
|
||||||
@@ -68,24 +89,32 @@ in {
|
|||||||
|
|
||||||
programs.notmuch = {
|
programs.notmuch = {
|
||||||
enable = true;
|
enable = true;
|
||||||
new.tags = [ "unread" "inbox" ];
|
new.tags = [ "new" ];
|
||||||
search.excludeTags = [ "deleted" "spam" ];
|
search.excludeTags = [ "deleted" "spam" ];
|
||||||
hooks.postNew = generateTaggingScript [
|
hooks.postNew = "${pkgs.afew}/bin/afew --tag --new";
|
||||||
{
|
};
|
||||||
query = "to:miaengiadina-pwa@noreply.github.com AND subject:\"PR run failed\"";
|
|
||||||
tags = [ "+deleted" ];
|
programs.afew = let
|
||||||
}
|
generateFilters = rules:
|
||||||
{
|
lib.concatStringsSep "\n" (lib.lists.imap1
|
||||||
query = lib.concatStringsSep " OR " [
|
(index: {message ? null, query, tags}: ''
|
||||||
"from:noreply-local-guides@google.com"
|
[Filter.${toString index}]
|
||||||
"from:google-maps-noreply@google.com"
|
query = ${query}
|
||||||
"subject:fd-noti"
|
tags = ${lib.concatStringsSep ";" tags}
|
||||||
"from:nebenan.de"
|
${lib.optionalString (message != null) "message = ${message}"}
|
||||||
"to:miaengiadina-pwa@noreply.github.com"
|
'')
|
||||||
];
|
rules
|
||||||
tags = [ "-inbox -unread" ];
|
);
|
||||||
}
|
in {
|
||||||
];
|
enable = true;
|
||||||
|
extraConfig = ''
|
||||||
|
[SpamFilter]
|
||||||
|
[ArchiveSentMailsFilter]
|
||||||
|
|
||||||
|
${generateFilters tagRules}
|
||||||
|
|
||||||
|
[InboxFilter]
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
accounts.email.maildirBasePath = "${config.users.users.me.home}/mail";
|
accounts.email.maildirBasePath = "${config.users.users.me.home}/mail";
|
||||||
|
|||||||
Reference in New Issue
Block a user