reorganization

This commit is contained in:
Till 2026-03-10 14:34:01 +01:00
parent bc44678dac
commit 91b5421848
46 changed files with 47 additions and 51 deletions

View file

@ -0,0 +1,16 @@
# compose
macro index,pager go "<shell-escape>mbsync $my_account && notmuch new<enter>" "Sync this account"
macro index,pager gO "<shell-escape>mbsync -a && notmuch new<enter>" "Sync all accounts"
bind index,pager / noop
macro index,pager // "<vfolder-from-query-readonly>folder:/$my_account/" "Find in account"
macro index,pager g/ "<vfolder-from-query-readonly>" "Find in all accounts"
macro index,pager /! "<vfolder-from-query-readonly>folder:+$my_account/$my_nm_spoolfile" "Find in inbox"
macro index,pager /< "<vfolder-from-query-readonly>folder:+$my_account/$my_nm_record" "Find in sent"
macro index,pager /> "<vfolder-from-query-readonly>folder:+$my_account/$my_nm_mbox" "Find in archive"
macro index,pager /d "<vfolder-from-query-readonly>folder:+$my_account/$my_nm_postponed" "Find in drafts"
macro index,pager /t "<vfolder-from-query-readonly>folder:+$my_account/$my_nm_trash" "Find in trash"
macro index,pager /j "<vfolder-from-query-readonly>folder:+$my_account/$my_nm_junk" "Find in junk"

View file

@ -0,0 +1,73 @@
# Alias
set alias_file = ~/.local/share/neomutt/aliases.neomuttrc
source $alias_file
# External
set my_download_folder = ~/tmp
# Status bar
set status_chars = "✔↻٪A"
unset help
# Index
set index_format = "%-25.25F %<[y?%<[7d?%<[d?%[ %H:%M]&%[%a %H:%M]>&%[%d.%m. %Hh]>&%[%d.%m.%Y]> %Z %?X?▼ &?%s"
set strict_threads
set send_charset = "utf-8:iso-8859-1:us-ascii"
set charset = "utf-8"
# Pager view
set pager_index_lines = 10
set pager_context = 3
set pager_stop
set smart_wrap
set menu_scroll
set tilde
unset markers
ignore *
unignore from: to: cc: bcc: date: subject:
unhdr_order *
hdr_order from: to: cc: bcc: date: subject:
alternative_order text/plain text/enriched text/html
auto_view text/html
# Attachments
set rfc2047_parameters
set attach_save_dir = $my_download_folder
# Colors
color indicator brightwhite brightblack
color index_flags brightmagenta default '.*'
color index_date cyan default
color index brightblack default '~N'
color header brightblack default ".*"
color header brightgreen default "^(Subject)"
color header yellow default "^(From|To|CC|BCC)"
color header blue default "^Date"
color message cyan default
color error red default
color tilde black default
color normal default default
color attachment brightblack default
color search black yellow
color quoted green default
color quoted1 blue default
color quoted2 cyan default
color quoted3 yellow default
color quoted4 red default
color quoted5 brightred default
color signature cyan default
color underline black default
color body blue default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses
color body blue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL
color body red default "(BAD signature)"
color body green default "(Good signature)"
color body brightblack default "^gpg: .*"
color body green default "^gpg: Good signature .*"
color body red default "^gpg: BAD signature from.*"

View file

@ -0,0 +1,282 @@
{ config, pkgs, lib, ... }:
let
makeConfig = accountName:
''
unset reverse_name
unset crypt_auto_pgp
unset crypt_auto_smime
set my_account='${ accountName }'
macro index,pager / "<vfolder-from-query>tag:${ accountName } "
unalternates *
set nm_record_tags = "+sent -inbox -unread +${ accountName }";
set my_signature = ${ pkgs.writeText "signature.txt" config.accounts.email.accounts.${accountName}.signature.text }
set status_format = " [ %r ] $my_account %f (%lB) %> %m messages%?n? [ %n new ]?%?d? [ %d to delete ]?%?t? [ %t tagged ]? "
'';
makeAccount = accountName: {
signature.showSignature = "append";
smtp.tls.useStartTls = true;
msmtp.enable = true;
mbsync = {
enable = true;
create = "maildir";
expunge = "both";
};
neomutt = {
enable = true;
sendMailCommand = "${lib.getExe pkgs.msmtp} -a ${ accountName }";
};
notmuch = {
enable = true;
neomutt = {
virtualMailboxes = [
{ name = "Inbox"; query = "tag:${ accountName } and tag:inbox"; }
{ name = "Archive"; query = "tag:${ accountName } and not tag:sent and not tag:draft"; }
{ name = "Sent"; query = "tag:${ accountName } and tag:sent"; }
{ name = "Drafts"; query = "tag:${ accountName } and tag:draft"; }
{ name = "Spam"; query = "tag:${ accountName } and tag:spam"; }
{ name = "Trash"; query = "tag:${ accountName } and tag:trash"; }
];
};
};
};
mailcap_path = pkgs.writeText "neomutt_mailcap" ''
application/pdf; zathura %s
multipart; xdg-open %s
text/html; firefox %s; description=HTML Text; nametemplate=%s.html; needsterminal
text/html; w3m -v -F -T text/html -dump %s; copiousoutput
text/calendar; khal import %s
text; neomutt %s
application; xdg-open %s
image; xdg-open %s
video; xdg-open %s
audio; xdg-open %s
message; xdg-open %s
model; xdg-open %s
'';
in
{
programs.mu.enable = true;
accounts.email = {
maildirBasePath = "${config.xdg.dataHome}/mail";
accounts = {
gu = { name, ... }: lib.attrsets.recursiveUpdate (makeAccount name) {
primary = true;
address = "straube@geo.uni-frankfurt.de";
realName = "Till Straube";
imap.host = "imap.server.uni-frankfurt.de";
smtp.host = "smtpauth.rz.uni-frankfurt.de";
userName = "tstraube";
passwordCommand = "pass uni/hrz";
signature = {
text = ''
Dr. Till Straube (he/him)
Dept. of Human Geography
Goethe University Frankfurt
'';
};
neomutt = {
extraConfig = makeConfig name + ''
color status blue default
alternates ^tstraube@(em|rz)?.uni-frankfurt.de$
set crypt_auto_smime
'';
};
};
t9e = { name, ... }: lib.attrsets.recursiveUpdate (makeAccount name) {
address = "till.straube@t9e.me";
realName = "Till Straube";
imap.host = "arielle.ktiu.net";
smtp.host = "arielle.ktiu.net";
userName = "till.straube@t9e.me";
signature.text = ''
Till Straube (he/him)
PGP key: https://keys.openpgp.org/search?q=till.straube@t9e.me
'';
neomutt = {
extraConfig = makeConfig name + ''
color status green default
alternates @t9e.me$ @ktiu.net$ ^(tillkowski|till.straube)@gmail.com$
set reverse_name
set crypt_auto_pgp
'';
};
msmtp.extraConfig.port = "587";
passwordCommand = "pass accounts/ktiu-imap";
};
ksh = { name, ... }: lib.attrsets.recursiveUpdate (makeAccount name) {
address = "kein_schlussstrich_hessen@systemli.org";
realName = "Kein Schlussstrich Hessen";
imap.host = "mail.systemli.org";
smtp.host = "mail.systemli.org";
userName = "kein_schlussstrich_hessen@systemli.org";
signature.text = ''
Kein Schlussstrich Hessen
PGP Key: https://keys.openpgp.org/search?q=kein_schlussstrich_hessen@systemli.org
'';
neomutt = {
extraConfig = makeConfig name + ''
color status red default
set crypt_auto_pgp
'';
};
passwordCommand = "pass ksh/systemli";
};
};
};
programs.msmtp.enable = true;
programs.mbsync.enable = true;
programs.notmuch = {
enable = true;
search.excludeTags = [ "trash" "spam" ];
new.tags = [ "new" "unread" ];
hooks = {
preNew = ''
notmuch tag +draft -- 'folder:"/\/Drafts$/"'
mbsync --all
'';
postNew = ''
notmuch tag +gu -- tag:new path:gu/**
notmuch tag +t9e -- tag:new path:t9e/**
notmuch tag +ksh -- tag:new path:ksh/**
notmuch tag +inbox -- tag:new 'folder:"/\/Inbox$/"'
notmuch tag +sent -unread -- tag:new 'folder:"/\/Sent$/"'
notmuch tag +trash -unread -- tag:new 'folder:"/\/Trash$/"'
notmuch tag +draft -unread -- tag:new 'folder:"/\/Drafts$/"'
notmuch tag +spam -- tag:new 'folder:"/\/Spam$/"'
notmuch tag +spam -- tag:new 'folder:"/\/Junk$/"'
notmuch tag -new -- tag:new
'';
};
};
programs.neomutt = {
enable = true;
vimKeys = true;
changeFolderWhenSourcingAccount = true;
editor = "nvim -c 'call woof#init#Init()'";
sort = "reverse-date-received";
unmailboxes = true;
settings = {
abort_noattach = "ask-yes";
abort_noattach_regex = "\"(attach|enclosed|anbei|anhängen|angehängt|anhang|anhänge|hängt an)\"";
auto_edit = "yes";
beep = "no";
confirm_append = "no";
crypt_auto_sign = "yes";
crypt_replyencrypt = "yes";
crypt_replysign = "yes";
crypt_replysignencrypted = "yes";
crypt_verify_sig = "yes";
edit_headers = "yes";
forward_attachments = "yes";
forward_format = "\"Fwd: %s\"";
forward_quote = "yes";
help = "no";
include = "yes";
mail_check_stats = "yes";
mailcap_path = "${ mailcap_path }";
mark_old = "no";
markers = "no";
mbox_type = "Maildir";
menu_scroll = "yes";
mime_type_query_command = "\"file -b --mime-type %s\"";
nm_record = "yes";
pager_context = "3";
pager_index_lines = "5";
pager_stop = "yes";
query_command= "\"khard email --parsable '%s'\"";
recall = "no";
resume_draft_files = "yes";
reverse_real_name = "no";
shell = "/bin/sh";
sleep_time = "0";
smart_wrap = "yes";
status_chars = "٪A";
tilde = "yes";
use_envelope_from = "yes";
virtual_spool_file = "yes";
wait_key = "no";
};
binds = [
{ key = "m"; map = [ "index" "pager" ]; action = "noop"; }
{ key = "k"; map = [ "pager" ]; action = "previous-entry"; }
{ key = "j"; map = [ "pager" ]; action = "next-entry"; }
{ key = "<return>"; map = [ "index" ]; action = "display-message"; }
{ key = "<space>"; map = "index"; action = "entire-thread"; }
{ key = "gf"; map = [ "index" "pager" ]; action = "change-folder"; }
{ key = "<Tab>"; map = [ "editor" ]; action = "complete-query"; }
{ key = "P"; map = [ "compose" ]; action = "pgp-menu"; }
{ key = "p"; map = [ "compose" ]; action = "postpone-message"; }
];
macros = [
{ key = "gu"; map = [ "index" "pager" ]; action = "<vfolder-from-query>tag:dummy<enter>:source ${config.xdg.configHome}/neomutt/gu<enter>g!"; }
{ key = "gm"; map = [ "index" "pager" ]; action = "<vfolder-from-query>tag:dummy<enter>:source ${config.xdg.configHome}/neomutt/t9e<enter>g!"; }
{ key = "gk"; map = [ "index" "pager" ]; action = "<vfolder-from-query>tag:dummy<enter>:source ${config.xdg.configHome}/neomutt/ksh<enter>g!"; }
{ key = "Y"; map = [ "index" "pager" ]; action = "<modify-labels-then-hide>"; }
{ key = "y"; map = [ "index" "pager" ]; action = "<modify-labels-then-hide>-inbox -unread -spam -trash<enter><sync-mailbox>"; }
{ key = "J"; map = [ "index" "pager" ]; action = "<modify-labels-then-hide>+spam -inbox -unread -trash<enter><sync-mailbox>"; }
{ key = "I"; map = [ "index" "pager" ]; action = "<modify-labels-then-hide>+inbox -old -spam -trash<enter><sync-mailbox>"; }
{ key = "Y"; map = [ "index" "pager" ]; action = "<modify-labels-then-hide>"; }
{ key = "dd"; map = [ "index" "pager" ]; action = "<modify-labels-then-hide>+trash -inbox -unread -spam<enter><sync-mailbox>"; }
{ key = "g!"; map = [ "index" "pager" ]; action = "<change-vfolder>Inbox<enter>"; }
{ key = "g<"; map = [ "index" "pager" ]; action = "<change-vfolder>Sent<enter>"; }
{ key = "g>"; map = [ "index" "pager" ]; action = "<change-vfolder>Archive<enter>"; }
{ key = "gj"; map = [ "index" "pager" ]; action = "<change-vfolder>Spam<enter>"; }
{ key = "gd"; map = [ "index" "pager" ]; action = "<change-vfolder>Drafts<enter>"; }
{ key = "gt"; map = [ "index" "pager" ]; action = "<change-vfolder>Trash<enter>"; }
{ key = "go"; map = [ "index" "pager" ]; action = "<shell-escape>notmuch new<enter>"; }
{ key = "V"; map = ["index" "pager"]; action = "<view-attachments><search>html<enter><view-mailcap><exit>"; }
{ key = "mar"; map = [ "index" "pager" ]; action = "<tag-pattern>new<enter><tag-prefix-cond><clear-flag>n<enter><tag-prefix-cond><clear-flag>*<enter>"; }
{ key = "A"; map = [ "index" "pager" ]; action = "<pipe-message>khard add-email --vcard-version=4.0<return>"; }
{ key = "S"; map = [ "index" "pager" ]; action = "<pipe-message>ripmime -i - -d ~/tmp && rm ~/tmp/textfile*"; }
{ key = "gb"; map = [ "index" "pager" ]; action = "<pipe-message>urlscan<enter>"; }
{ key = "I"; map = [ "compose" ]; action = "<attach-file>`tmpfile=$(mktemp -u --suffix .png -t XXXXXXXXXXXX -p ~/tmp) && wl-paste -t image/png > \"$tmpfile\" && echo \"$tmpfile\"`<enter>"; }
{ key = "p"; map = [ "compose" ]; action = "<postpone-message>"; }
{ key = "c"; map = [ "index" "pager" ]; action = "<enter-command>set signature=$my_signature<enter><mail>"; }
{ key = "r"; map = [ "index" "pager" ]; action = "<enter-command>unset signature<enter><reply>"; }
{ key = "a"; map = [ "index" "pager" ]; action = "<enter-command>unset signature<enter><group-reply>"; }
{ key = "f"; map = [ "index" "pager" ]; action = "<enter-command>unset signature<enter><forward-message>"; }
{ key = "l"; map = [ "index" "pager" ]; action = "<enter-command>unset signature<enter><list-reply>"; }
];
extraConfig = builtins.readFile ./config.neomuttrc;
};
xdg.configFile."neomutt/bindings.neomuttrc".source = ./bindings.neomuttrc;
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = vim-pathogen;
config = "execute pathogen#infect()";
}
];
xdg.configFile."nvim/bundle/woof-vim" = {
source = config.lib.file.mkOutOfStoreSymlink "/home/till/devel/woof-vim";
recursive = true;
};
}