{ config, pkgs, ... }: { environment.systemPackages = with pkgs; [ lynx urlscan ]; home-manager.users.andrew = let homeDir = "${config.users.users.andrew.home}"; in { accounts.email.maildirBasePath = "mail"; accounts.email.accounts."andrew" = { address = "andrew@akon.city"; realName = "Andrew Opalach"; userName = "andrew@akon.city"; maildir.path = ""; primary = true; passwordCommand = "${pkgs.pass}/bin/pass andrew@akon.city"; folders.inbox = "INBOX"; imap = { host = "mail.akon.city"; port = 993; tls.enable = true; }; smtp = { host = "mail.akon.city"; port = 465; tls.enable = true; }; mbsync = { enable = true; create = "maildir"; }; msmtp.enable = true; imapnotify = { enable = true; boxes = [ "INBOX" ]; onNotify = "${pkgs.notmuch}/bin/notmuch new"; onNotifyPost = "${pkgs.libnotify}/bin/notify-send '📥 New Mail!'"; }; notmuch = { enable = true; neomutt = { enable = true; virtualMailboxes = [ { name = "INBOX"; query = "folder:INBOX"; } { name = "Sent"; query = "folder:Sent"; } { name = "Archive"; query = "folder:Archive"; } { name = "Drafts"; query = "folder:Drafts"; } { name = "Trash"; query = "folder:Trash"; } { name = "Junk"; query = "folder:Junk"; } ]; }; }; neomutt.enable = true; }; programs.mbsync.enable = true; services.mbsync.enable = true; programs.msmtp.enable = true; services.imapnotify.enable = true; programs.notmuch = { enable = true; hooks = { preNew = "${pkgs.notmuch}/bin/notmuch search --output=files --format=text0 tag:deleted | xargs -0 rm -f; ${pkgs.isync}/bin/mbsync --all -ngfuX"; }; }; programs.neomutt = { enable = true; vimKeys = false; sidebar = { enable = true; width = 18; shortPath = true; }; sort = "reverse-date"; binds = [ { key = "i"; action = "noop"; map = [ "index" "pager" ]; } { key = "g"; action = "noop"; map = [ "index" "pager" ]; } { key = "gg"; action = "first-entry"; map = [ "index" ]; } { key = "j"; action = "next-entry"; map = [ "index" ]; } { key = "k"; action = "previous-entry"; map = [ "index" ]; } { key = "G"; action = "last-entry"; map = [ "index" ]; } { key = ""; action = "view-mailcap"; map = [ "attach" ]; } { key = "l"; action = "view-mailcap"; map = [ "attach" ]; } { key = ""; action = "noop"; map = [ "editor" ]; } { key = "j"; action = "next-line"; map = [ "pager" ]; } { key = "k"; action = "previous-line"; map = [ "pager" ]; } { key = "gg"; action = "top"; map = [ "pager" ]; } { key = "G"; action = "bottom"; map = [ "pager" ]; } { key = "l"; action = "view-attachments"; map = [ "pager" ]; } { key = "h"; action = "noop"; map = [ "index" ]; } { key = "h"; action = "exit"; map = [ "pager" "attach" ]; } { key = "\\Ck"; action = "sidebar-prev"; map = [ "index" "pager" ]; } { key = "\\Cj"; action = "sidebar-next"; map = [ "index" "pager" ]; } { key = "\\Co"; action = "sidebar-open"; map = [ "index" "pager" ]; } { key = ""; action = "complete-query"; map = [ "editor" ]; } { key = "l"; action = "select-entry"; map = [ "browser" ]; } { key = "gg"; action = "top-page"; map = [ "browser" ]; } { key = "G"; action = "bottom-page"; map = [ "browser" ]; } { key = "H"; action = "view-raw-message"; map = [ "index" "pager" ]; } ]; macros = let delete-macro = "+deleted"; undelete-macro = "-deleted"; in [ { key = "\\Cb"; action = "${pkgs.urlscan}/bin/urlscan -cW"; map = [ "index" "pager" ]; } { key = "\\Cb"; action = "${pkgs.urlscan}/bin/urlscan -cW"; map = [ "attach" "compose" ]; } { key = "h"; action = ".."; map = [ "browser" ]; } { key = "o"; action = "${pkgs.notmuch}/bin/notmuch new"; map = [ "index" ]; } { key = "\\Cd"; action = delete-macro; map = [ "index" ]; } { key = "\\Cu"; action = undelete-macro; map = [ "index" ]; } ]; extraConfig = '' unmailboxes ${homeDir}/mail/INBOX set mail_check_stats = yes set delete = ask-yes # https://github.com/LukeSmithxyz/mutt-wizard/blob/10a16e0ee6442425e7ca1634b1d3356e6d4d04f6/share/mutt-wizard.muttrc#L14 set rfc2047_parameters = yes set sleep_time = 0 set markers = no set wait_key = no set reverse_name set fast_reply set fcc_attach set mime_forward = no set forward_attachments = yes set forward_format = "Fwd: %s" set forward_quote set index_format="%2C (%Z) %[%D %I:%M %p] %-15.15F %s (%c, %g)" auto_view text/html auto_view application/pgp-encrypted alternative_order text/plain text/enriched text/html color normal blue black color attachment brightyellow black color hdrdefault blue black color indicator black blue color markers brightred black color quoted green black color signature blue black color status black red color tilde blue black color tree red black color index red black ~D color index magenta black ~T color header brightgreen black ^From: color header brightblue black ^To: color header brightblue black ^Reply-To: color header brightblue black ^Cc: color header brightblue black ^Subject: color body brightred black [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ color body brightblue black (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ ''; }; home.file.".mailcap".source = ../../files/mailcap; }; }