diff --git a/home/roles/email/default.nix b/home/roles/email/default.nix index 234aac1..6ba2366 100644 --- a/home/roles/email/default.nix +++ b/home/roles/email/default.nix @@ -62,7 +62,7 @@ in primary_email=john@ogle.fyi [new] - tags=unread;inbox; + tags=unread;new; ignore= [search] @@ -72,6 +72,38 @@ in synchronize_flags=true ''; + # Notmuch post-new hook for folder-based tagging + home.file."Mail/.notmuch/hooks/post-new" = { + executable = true; + text = '' + #!${pkgs.bash}/bin/bash + # Tag messages based on their maildir folder location + # This runs after 'notmuch new' indexes new messages + + # Process only messages with the 'new' tag (just indexed) + # Add inbox tag only for messages in INBOX folder + ${pkgs.notmuch}/bin/notmuch tag +inbox -- tag:new AND folder:INBOX + + # Add sent tag for messages in Sent folder + ${pkgs.notmuch}/bin/notmuch tag +sent -inbox -- tag:new AND folder:Sent + + # Add draft tag for messages in Drafts folder + ${pkgs.notmuch}/bin/notmuch tag +draft -inbox -- tag:new AND folder:Drafts + + # Add spam tag for messages in Spam folder + ${pkgs.notmuch}/bin/notmuch tag +spam -inbox -unread -- tag:new AND folder:Spam + + # Add deleted tag for messages in Trash folder + ${pkgs.notmuch}/bin/notmuch tag +deleted -inbox -unread -- tag:new AND folder:Trash + + # Add archive tag for messages in Archive folder + ${pkgs.notmuch}/bin/notmuch tag +archive -inbox -- tag:new AND folder:Archive + + # Remove the temporary 'new' tag from all messages + ${pkgs.notmuch}/bin/notmuch tag -new -- tag:new + ''; + }; + # msmtp configuration home.file.".msmtprc".text = '' # Default settings