stockholm/lass/2configs/mail.nix

131 lines
4.4 KiB
Nix
Raw Normal View History

2016-04-19 11:23:38 +00:00
{ pkgs, ... }:
let
msmtprc = pkgs.writeText "msmtprc" ''
defaults
logfile ~/.msmtp.log
account prism
host prism.r
account default: prism
'';
2016-06-22 17:12:34 +00:00
msmtp = pkgs.writeBashBin "msmtp" ''
${pkgs.coreutils}/bin/tee >(${pkgs.notmuch}/bin/notmuch insert +sent) | \
2016-11-24 23:22:34 +00:00
${pkgs.msmtp}/bin/msmtp -C ${msmtprc} "$@"
2016-04-19 11:23:38 +00:00
'';
muttrc = pkgs.writeText "muttrc" ''
2016-04-19 14:57:56 +00:00
# gpg
2017-02-06 14:09:10 +00:00
source ${pkgs.neomutt}/share/doc/mutt/samples/gpg.rc
2016-04-19 14:57:56 +00:00
set pgp_use_gpg_agent = yes
set pgp_sign_as = 0x976A7E4D
set crypt_autosign = yes
set crypt_replyencrypt = yes
2016-05-19 22:16:46 +00:00
set crypt_verify_sig = yes
set pgp_verify_command = "gpg --no-verbose --batch --output - --verify %s %f"
macro index \Cv \
"<enter-command> set my_crypt_verify_sig=\$crypt_verify_sig<enter> \
<enter-command> set crypt_verify_sig=yes<enter> \
<display-message><enter-command> set crypt_verify_sig=\$my_crypt_verify_sig<enter>" \
'Verify PGP signature and open the message'
macro pager \Cv \
"<exit><enter-command> set my_crypt_verify_sig=\$crypt_verify_sig<enter> \
<enter-command> set crypt_verify_sig=yes<enter> \
<display-message><enter-command> set crypt_verify_sig=\$my_crypt_verify_sig<enter>" \
'Verify PGP signature'
2016-04-19 14:57:56 +00:00
2016-04-19 11:23:38 +00:00
# notmuch
set nm_default_uri="notmuch://$HOME/Maildir" # path to the maildir
set nm_record = yes
set nm_record_tags = "-inbox me archive"
set virtual_spoolfile=yes # enable virtual folders
2016-06-22 17:12:34 +00:00
set sendmail="${msmtp}/bin/msmtp" # enables parsing of outgoing mail
2016-08-24 06:40:01 +00:00
set from="lassulus@lassul.us"
2016-04-19 11:23:38 +00:00
set use_from=yes
set envelope_from=yes
set index_format="%4C %Z %?GI?%GI& ? %[%d/%b] %-16.15F %?M?(%3M)& ? %s %> %?g?%g?"
virtual-mailboxes \
"INBOX" "notmuch://?query=tag:inbox and NOT tag:killed"\
"Unread" "notmuch://?query=tag:unread"\
"TODO" "notmuch://?query=tag:TODO"\
"Starred" "notmuch://?query=tag:*"\
"Archive" "notmuch://?query=tag:archive"\
"Sent" "notmuch://?query=tag:sent"\
"Junk" "notmuch://?query=tag:junk"
tag-transforms "junk" "k" \
"unread" "u" \
"replied" "" \
"TODO" "T" \
# notmuch bindings
macro index \\\\ "<vfolder-from-query>" # looks up a hand made query
macro index + "<modify-labels>+*\n<sync-mailbox>" # tag as starred
macro index - "<modify-labels>-*\n<sync-mailbox>" # tag as unstarred
#killed
bind index d noop
bind pager d noop
2017-03-14 10:17:57 +00:00
bind index S noop
bind index s noop
2016-04-19 11:23:38 +00:00
bind pager S noop
2017-03-14 10:17:57 +00:00
bind pager s noop
2016-04-19 11:23:38 +00:00
macro index S "<modify-labels-then-hide>-inbox -unread +junk\n" # tag as Junk mail
2017-03-14 10:17:57 +00:00
macro index s "<modify-labels>-junk\n" # tag as Junk mail
2016-04-19 11:23:38 +00:00
macro pager S "<modify-labels-then-hide>-inbox -unread +junk\n" # tag as Junk mail
2017-03-14 10:17:57 +00:00
macro pager s "<modify-labels>-junk\n" # tag as Junk mail
bind index A noop
bind index a noop
bind pager A noop
bind pager a noop
macro index A "<modify-labels>+archive -unread -inbox\n" # tag as Archived
macro index a "<modify-labels>-archive\n" # tag as Archived
macro pager A "<modify-labels>+archive -unread -inbox\n" # tag as Archived
macro pager a "<modify-labels>-archive\n" # tag as Archived
2016-04-19 11:23:38 +00:00
bind index t noop
bind pager t noop
macro index t "<modify-labels>+TODO\n" # tag as Archived
# sidebar
set sidebar_width = 20
set sidebar_visible = yes # set to "no" to disable sidebar view at startup
color sidebar_new yellow default
# sidebar bindings
bind index <left> sidebar-prev # got to previous folder in sidebar
bind index <right> sidebar-next # got to next folder in sidebar
bind index <space> sidebar-open # open selected folder from sidebar
# sidebar toggle
macro index ,@) "<enter-command> set sidebar_visible=no; macro index ~ ,@( 'Toggle sidebar'<Enter>"
macro index ,@( "<enter-command> set sidebar_visible=yes; macro index ~ ,@) 'Toggle sidebar'<Enter>"
macro index ~ ,@( 'Toggle sidebar' # toggle the sidebar
'';
2017-03-25 21:57:13 +00:00
mutt = pkgs.concat "mutt" [
pkgs.neomutt
(pkgs.writeDashBin "mutt" ''
exec ${pkgs.neomutt}/bin/mutt -F ${muttrc} $@
'')
];
2016-04-19 11:23:38 +00:00
in {
environment.systemPackages = [
msmtp
mutt
pkgs.much
pkgs.notmuch
];
}