about summary refs log tree commit diff
path: root/users/fcuny/desktop/trust
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-02-14 06:44:35 -0800
committerFranck Cuny <franck@fcuny.net>2022-02-14 06:44:35 -0800
commit5e4377100c3755a15c1aebe57aba5c781c2dcf06 (patch)
treeae61fa91fcc40cc680dc644cdfb813b4dc927cea /users/fcuny/desktop/trust
parentemail: add initial email configuration (diff)
downloadworld-5e4377100c3755a15c1aebe57aba5c781c2dcf06.tar.gz
email: multiple fixes
Update the configuration for mbsync so that the name of the mail's
folder matches the one from our back (fastmail -> Fastmail).

Some changes to the pre-fetch script and move it into the notmuch
folder.

Set the environment variables for the systemd unit.
Diffstat (limited to '')
-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";
     };