about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--users/fcuny/desktop/trust/email.nix23
1 files changed, 15 insertions, 8 deletions
diff --git a/users/fcuny/desktop/trust/email.nix b/users/fcuny/desktop/trust/email.nix
index 641166e..ba20634 100644
--- a/users/fcuny/desktop/trust/email.nix
+++ b/users/fcuny/desktop/trust/email.nix
@@ -4,10 +4,12 @@
   accounts.email = {
     maildirBasePath = "${config.home.homeDirectory}/.mail";
     accounts = {
-      fastmail = rec {
+      Fastmail = rec {
         primary = true;
         address = "franck@fcuny.net";
         userName = address;
+        realName = "Franck Cuny";
+        aliases =  [ "franck.cuny@gmail.com" ];
         passwordCommand = "pass email/imap.fastmail.com";
         imap.host = "imap.fastmail.com";
         mbsync = {
@@ -25,11 +27,12 @@
   programs.notmuch = {
     enable = true;
     maildir.synchronizeFlags = true;
-    new.tags = [ "new" ];
-    search.excludeTags = [ "spam" ];
+    new.tags = [ "unread" "inbox" ];
+    new.ignore = [ "Trash" ];
+    search.excludeTags = [ "spam" "deleted" ];
   };
 
-  xdg.configFile."mbsync/imap-sync.sh" = {
+  xdg.configFile."notmuch/imap-sync.sh" = {
     executable = true;
     text = ''
       #!${pkgs.stdenv.shell}
@@ -38,13 +41,13 @@
       # Strip UIDs from filenames when moving mails so that mbsync doesn't get confused.
       mv_renamed() {
         while IFS= read -r name; do
-        	flags=$(echo "$name" | cut -d':' -f2)
+          flags=$(echo "$name" | cut -d':' -f2)
           new_name="$(basename $name | awk -F ',' '{print $1}')"
-          [ -f "$name" ] && mv -nv "${name}" "${1}/${new_name}"
+          [ -f "$name" ] && mv -nv "$name" "$1/$new_name"
         done
       }
 
-      ${pkgs.notmuch}/bin/notmuch search --output=files -- not tag:inbox and folder:Fastmail/Inbox | mv_renamed ${MAILDIR}/Fastmail/Archive/cur
+      ${pkgs.notmuch}/bin/notmuch search --output=files -- not tag:inbox and folder:Fastmail/Inbox | mv_renamed $MAILDIR/Fastmail/Archive/cur
   '';
   };
 
@@ -54,7 +57,11 @@
     };
     Service = {
       Type = "oneshot";
-      ExecStartPre = "${config.xdg.configFile}/mbsync/imap-sync.sh";
+      Environment = [
+       "PASSWORD_STORE_DIR=${config.programs.password-store.settings.PASSWORD_STORE_DIR}"
+        "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc"
+      ];
+      ExecStartPre = "${config.xdg.configHome}/notmuch/imap-sync.sh";
       ExecStart = "${pkgs.isync}/bin/mbsync -a";
       ExecStartPost = "${pkgs.notmuch}/bin/notmuch new --quiet";
     };