feat(accounts/mail): implement afew filters management

This commit is contained in:
Yorick Barbanneau 2025-08-05 02:02:19 +02:00
parent 4ba9224348
commit f9ebf23688
2 changed files with 12 additions and 4 deletions

6
flake.lock generated
View file

@ -61,10 +61,10 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1754265461, "lastModified": 1754351405,
"narHash": "sha256-qVA40ypUxsQR+kpzgqrsS2JrdwS6CI7JQcvpLjc+nlg=", "narHash": "sha256-q7KxXc9P60DAf2iUNXF42tUGkZErd0n59JuFxUMimlo=",
"ref": "main", "ref": "main",
"rev": "7ce0411fc0c480211951ef58b263c5eb72579681", "rev": "cc10d2bdfb86551b7781041a1583388370da82cc",
"shallow": true, "shallow": true,
"type": "git", "type": "git",
"url": "ssh://git@git.epha.se:24422/ephase/nix-private.git" "url": "ssh://git@git.epha.se:24422/ephase/nix-private.git"

View file

@ -63,7 +63,14 @@ in
v.afew.mailMover v.afew.mailMover
else {} else {}
) cfg.accountConfigs); ) cfg.accountConfigs);
in { mailFilterRules = lib.flatten (
lib.attrsets.mapAttrsToList (
n: v:
if lib.hasAttrByPath ["afew" "filters"] v then
v.afew.filters
else []
) cfg.accountConfigs);
in {
enable = true; enable = true;
extraConfig = '' extraConfig = ''
[FolderNameFilter] [FolderNameFilter]
@ -79,6 +86,7 @@ in
[ArchiveSentMailsFilter] [ArchiveSentMailsFilter]
sent_tag = sent sent_tag = sent
[InboxFilter] [InboxFilter]
${lib.concatImapStrings (p: e: "\n\n[Filter.${toString p}]\n ${lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "${n} = ${v}") e)}") mailFilterRules}
''; '';
}; };
programs.neomutt = let programs.neomutt = let