nixos-config/config/programs/mail.nix

131 lines
5 KiB
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{pkgs, ...}: let
2022-03-03 19:40:48 +00:00
mailcap = pkgs.writeText "mailcap" ''
text/html; ${pkgs.w3m}/bin/w3m -I %{charset} -T text/html; copiousoutput;
image/*; ${pkgs.imv}/bin/imv %s
'';
2022-03-03 19:41:57 +00:00
molokai = pkgs.writeText "molokai.muttrc" ''
# color setup
#
# ======================================================================
# INDEX OBJECT PATTERN? pattern description
# index pattern default highlighting of the entire index line
# index_date the date field
# index_flags pattern %S %Z the message flags
# index_number %C the message number
# index_collapsed %M the number of messages in a collapsed thread
# index_author pattern %AaFLn the author name
# index_subject pattern %s the subject line
# index_size %c %l the message size
# index_label %y %Y the message label
# index_tags %g the transformed message tags
# index_tag pattern/tag %G an individual message tag
# ======================================================================
color normal default default
color index_number brightblack default
color index_date magenta default
color index_flags yellow default .
color index_collapsed cyan default
color index green default ~N
color index green default ~v~(~N)
color index red default ~F
color index cyan default ~T
color index blue default ~D
color index_label brightred default
color index_tags red default
color index_tag brightmagenta default "encrypted"
color index_tag brightgreen default "signed"
color index_tag yellow default "attachment"
color body brightwhite default ([a-zA-Z\+]+)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ # urls
color body green default [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ # mail addresses
color attachment yellow default
color signature green default
color search brightred black
2022-03-03 19:41:57 +00:00
color indicator cyan brightblack
color error brightred default
color status brightcyan brightblack
color tree brightcyan default
color tilde cyan default
color progress white red
2022-03-03 19:41:57 +00:00
color sidebar_indicator brightred default
color sidebar_highlight cyan brightblack
color sidebar_divider red default
color sidebar_flagged red default
color sidebar_new green default
2022-03-03 19:41:57 +00:00
color hdrdefault color81 default
color header green default "^Subject: .*"
color header yellow default "^Date: .*"
color header red default "^Tags: .*"
2022-03-03 19:41:57 +00:00
color quoted color60 default
color quoted1 yellow default
2022-03-03 19:41:57 +00:00
color body brightgreen default "Good signature from.*"
color body green default "Fingerprint:( [A-Z0-9]{4}){5} ( [A-Z0-9]{4}){5}"
color body brightred default "Bad signature from.*"
color body brightred default "Note: This key has expired!"
color body brightmagenta default "Problem signature from.*"
color body brightmagenta default "WARNING: .*"
2022-03-03 19:41:57 +00:00
color compose header color81 default
color compose security_both brightgreen default
color compose security_sign brightmagenta default
color compose security_encrypt brightyellow default
color compose security_none brightred default
2022-03-03 19:41:57 +00:00
'';
2022-06-12 15:39:15 +00:00
in {
2022-01-19 13:56:46 +00:00
services.imapnotify.enable = true;
programs.mbsync.enable = true;
programs.notmuch = {
enable = true;
};
programs.neomutt = {
enable = true;
vimKeys = true;
sidebar = {
enable = true;
};
2022-01-19 15:03:11 +00:00
binds = [
{
2022-01-19 15:09:20 +00:00
key = "\\CA";
2022-01-19 15:03:11 +00:00
action = "sidebar-next";
2022-06-12 15:39:15 +00:00
map = ["index" "pager"];
2022-01-19 15:03:11 +00:00
}
{
2022-01-19 15:09:20 +00:00
key = "\\CL";
2022-01-19 15:03:11 +00:00
action = "sidebar-prev";
2022-06-12 15:39:15 +00:00
map = ["index" "pager"];
2022-01-19 15:03:11 +00:00
}
{
2022-01-19 15:09:20 +00:00
key = "\\CP";
2022-01-19 15:03:11 +00:00
action = "sidebar-open";
2022-06-12 15:39:15 +00:00
map = ["index" "pager"];
2022-01-19 15:03:11 +00:00
}
{
key = "<Return>"; # what the fuck is this mapping
action = "display-message";
2022-06-12 15:39:15 +00:00
map = ["index"];
}
{
key = "\\CV";
action = "display-message"; # i give up
2022-06-12 15:39:15 +00:00
map = ["index"];
}
2022-01-19 15:03:11 +00:00
];
2022-03-03 19:24:20 +00:00
extraConfig = ''
virtual-mailboxes "To Do" "notmuch://?query=tag:todo"
virtual-mailboxes "To Read" "notmuch://?query=tag:toread"
virtual-mailboxes "Blocked" "notmuch://?query=tag:blocked"
virtual-mailboxes "Archive" "notmuch://?query=tag:archive"
macro index,pager A "<modify-labels-then-hide>+archive -unread -inbox\n"
2022-03-03 19:24:20 +00:00
bind index,pager y modify-labels
2022-03-03 19:40:48 +00:00
set mailcap_path = ${mailcap}
2022-03-03 19:41:57 +00:00
source ${molokai}
2022-03-03 19:24:20 +00:00
'';
2022-01-19 13:56:46 +00:00
};
2022-01-19 14:48:24 +00:00
programs.msmtp.enable = true;
2022-01-19 13:56:46 +00:00
}