about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--users/fcuny/desktop/trust/email.nix42
1 files changed, 17 insertions, 25 deletions
diff --git a/users/fcuny/desktop/trust/email.nix b/users/fcuny/desktop/trust/email.nix
index ba20634..3bb6bd2 100644
--- a/users/fcuny/desktop/trust/email.nix
+++ b/users/fcuny/desktop/trust/email.nix
@@ -9,13 +9,14 @@
         address = "franck@fcuny.net";
         userName = address;
         realName = "Franck Cuny";
-        aliases =  [ "franck.cuny@gmail.com" ];
+        aliases = [ "franck.cuny@gmail.com" ];
         passwordCommand = "pass email/imap.fastmail.com";
         imap.host = "imap.fastmail.com";
         mbsync = {
           enable = true;
           create = "maildir";
           expunge = "both";
+          extraConfig.channel.CopyArrivalDate = "yes";
         };
         notmuch.enable = true;
       };
@@ -24,44 +25,35 @@
 
   programs.mbsync.enable = true;
 
+  programs.afew = {
+    enable = true;
+    extraConfig = ''
+      [SpamFilter]
+      [KillThreadsFilter]
+      [ArchiveSentMailsFilter]
+      [InboxFilter]
+    '';
+  };
+
   programs.notmuch = {
     enable = true;
     maildir.synchronizeFlags = true;
     new.tags = [ "unread" "inbox" ];
     new.ignore = [ "Trash" ];
     search.excludeTags = [ "spam" "deleted" ];
-  };
-
-  xdg.configFile."notmuch/imap-sync.sh" = {
-    executable = true;
-    text = ''
-      #!${pkgs.stdenv.shell}
-      MAILDIR=$HOME/.mail/
-
-      # 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)
-          new_name="$(basename $name | awk -F ',' '{print $1}')"
-          [ -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
-  '';
+    hooks = {
+      postNew = "${config.home.profileDirectory}/bin/afew -v --tag --new";
+    };
   };
 
   systemd.user.services.mbsync = {
-    Unit = {
-      Description = "mbsync synchronization";
-    };
+    Unit = { Description = "mbsync synchronization"; };
     Service = {
       Type = "oneshot";
       Environment = [
-       "PASSWORD_STORE_DIR=${config.programs.password-store.settings.PASSWORD_STORE_DIR}"
+        "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";
     };