{ pkgs, ... }: let homedir = builtins.getEnv "HOME"; in { accounts = { email = { maildirBasePath = "${homedir}/Mail"; accounts = { "ben@bsima.me" = { primary = true; realName = "Ben Sima"; address = "ben@bsima.me"; folders = { inbox = "INBOX"; }; imap = { host = "mail.bsima.me"; port = 993; }; smtp = { host = "mail.bsima.me"; port = 587; }; userName = "ben@bsima.me"; mbsync = { enable = true; create = "both"; expunge = "none"; }; notmuch.enable = true; msmtp.enable = true; passwordCommand = "pass bnet/helium/mail/ben"; }; "ben@simatime.com" = { realName = "Ben Sima"; address = "ben@simatime.com"; userName = "ben@simatime.com"; imap = { host = "mail.simatime.com"; port = 993; }; smtp = { host = "mail.simatime.com"; port = 587; }; mbsync = { enable = true; create = "both"; expunge = "none"; }; notmuch.enable = true; passwordCommand = "pass simatime/mail/ben"; msmtp.enable = true; }; "bsima@undergroundelephant.com" = { flavor = "gmail.com"; realName = "Ben Sima"; address = "bsima@undergroundelephant.com"; userName = "bsima@undergroundelephant.com"; mbsync = { enable = true; create = "both"; expunge = "none"; }; notmuch.enable = true; msmtp.enable = true; passwordCommand = "pass work/ue/gmail"; smtp.tls.useStartTls = true; }; "ben.sima@heroprojects.io" = { flavor = "gmail.com"; realName = "Ben Sima"; address = "ben.sima@heroprojects.io"; userName = "ben.sima@heroprojects.io"; mbsync = { enable = true; create = "both"; expunge = "none"; }; notmuch.enable = true; msmtp.enable = true; passwordCommand = "pass work/hero/gmail"; smtp.tls.useStartTls = true; }; }; }; }; programs = { notmuch = { enable = true; new.tags = [ "new" ]; hooks = { preNew = '' msmtp-queue -r mbsync --all ''; postNew = '' afew -tnv afew -mnv echo "re-tagging inbox.." afew -t tag:inbox ''; }; extraConfig = { search = { exclude_tags = "deleted;spam;"; }; }; }; afew = { enable = true; extraConfig = builtins.readFile ./afew.ini; }; mbsync = { enable = true; }; msmtp = { enable = false; }; }; }