dreckiger commit

This commit is contained in:
Simon Bruder 2021-01-18 21:42:44 +01:00
parent 342d537621
commit 9f7355f97c
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC

View file

@ -1,6 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
virtualMailboxes = { virtualMailboxes = {
#"One Month" = "date:30days..today";
"FabLab" = "body:fablab"; "FabLab" = "body:fablab";
"Git" = "from:{.*@github.com or .*@gitlab.com or no-reply+gitea@sbruder.de}'"; "Git" = "from:{.*@github.com or .*@gitlab.com or no-reply+gitea@sbruder.de}'";
}; };
@ -41,17 +42,6 @@ in
tls.useStartTls = true; tls.useStartTls = true;
}; };
signature = {
showSignature = "append";
text = ''
Simon Bruder
🔑 (GPG): 47E7 559E 037A 3565 2DBB F8AA 8D3C 82F9 F309 F8EC
📧 (E-Mail): simon@sbruder.de
📱 (mobile): +49 152 56561414
'';
};
gpg = { gpg = {
key = config.programs.gpg.settings.default-key; key = config.programs.gpg.settings.default-key;
signByDefault = true; signByDefault = true;
@ -65,71 +55,155 @@ in
create = "both"; create = "both";
expunge = "both"; expunge = "both";
}; };
#mu.enable = true; neomutt.enable = true;
neomutt = {
enable = true;
extraConfig = let account = config.accounts.email.accounts.personal; in
''
# revert home-manager setting
unmailboxes "${account.maildir.absPath}/${account.folders.inbox}"
unvirtual-mailboxes "My INBOX"
'';
};
notmuch.enable = true; notmuch.enable = true;
}; };
}; };
}; };
programs.neomutt = { # I am not using the home-manger neomutt module, since it includes many
enable = true; # opinionated, not-overridable defaults that I do not want
home.packages = with pkgs; [ neomutt ];
sidebar = { xdg.configFile."neomutt/neomuttrc".text =
enable = true; let
format = "%B%?F? [%F]?%* %?N?%N/?%S"; # adapted from home-manager
}; stringifyValue = value:
if lib.isBool value
binds = [ then (if value then "yes" else "no")
{ map = "index"; key = "\\\\"; action = "vfolder-from-query"; } else "'${toString value}'";
]; stringifySetOption = option: value:
if value == null
extraConfig = '' then "unset ${option}"
source ${mutt-solarized-dark} else "set ${option}=${stringifyValue value}";
stringifyOptions = options: lib.concatStringsSep
${mkVirtualMailbox "Inbox" "tag:inbox"}
${lib.concatStringsSep
"\n" "\n"
(lib.attrValues (lib.mapAttrsToList stringifySetOption options);
(lib.mapAttrs mkVirtualMailbox virtualMailboxes))}
stringifyBinds = binds: lib.concatMapStringsSep
"\n"
(bind:
let map' =
if (lib.isList bind.map)
then (lib.concatStringsSep "," bind.map)
else bind.map;
in
''bind ${map'} ${bind.key} "${bind.action}"'')
binds;
stringifySources = files: lib.concatMapStringsSep
"\n"
(file: "source ${file}")
files;
neomuttAccounts = lib.filter (a: a.neomutt.enable) (lib.attrValues config.accounts.email.accounts);
settings = {
# FIXME: comment all non-obvious
header_cache = "${config.xdg.cacheHome}/neomutt/headers/";
message_cachedir = "${config.xdg.cacheHome}/neomutt/messages/";
# General
implicit_autoview = true; # automatically view with program from mailcap
delete = true; # do not ask before deleting
mail_check_stats = true;
# Sidebar
sidebar_visible = true;
sidebar_folder_indent = true;
sidebar_format = "%D%?F? [%F]?%* %?N?%N/?%S";
sidebar_short_path = true;
sidebar_width = 22;
sidebar_delim_chars = "/";
# Editor
edit_headers = true;
reverse_name = true;
include = true;
# GPG
crypt_use_gpgme = true;
crypt_autosign = true;
pgp_use_gpg_agent = true;
mbox_type = "Maildir";
sort = "threads";
sendmail = "msmtpq --read-envelope-from --read-recipients";
# Defaults for all accounts
folder = config.accounts.email.maildirBasePath;
spoolfile = "notmuch://?query=tag:inbox";
#from = config.accounts.email.accounts.personal.address;
#postponed = "+Drafts";
#realname = "Simon Bruder";
#record = "+Sent";
#trash = "+Trash";
signature = pkgs.writeText "signature" ''
Simon Bruder
🔑 (GPG): 47E7 559E 037A 3565 2DBB F8AA 8D3C 82F9 F309 F8EC
📧 (E-Mail): simon@sbruder.de
📱 (mobile): +49 152 56561414
''; '';
# somehow makes <Enter> not work (?) # notmuch
#vimKeys = true; nm_default_uri = "notmuch:///home/simon/.local/share/mail";
settings = {
wait_key = "yes";
timeout = "3";
quit = "yes";
mail_check_stats = "yes";
edit_headers = "yes"; mailcap_path = pkgs.writeText "mutt-mailcap" ''
reverse_name = "yes";
include = "yes";
mailcap_path = toString (pkgs.writeText "mutt-mailcap" ''
text/html; firefox %s text/html; firefox %s
text/html; ${pkgs.w3m}/bin/w3m -I %{charset} -T text/html -dump; copiousoutput; text/html; ${pkgs.w3m}/bin/w3m -I %{charset} -T text/html -dump; copiousoutput;
application/pdf; zathura %s application/pdf; zathura %s
image/*; mpv %s image/*; mpv %s
''); '';
pgp_default_key = config.programs.gpg.settings.default-key; pgp_default_key = config.programs.gpg.settings.default-key;
nm_query_type = "threads"; nm_query_type = "threads";
}; };
};
binds = [
{ map = "index"; key = "\\\\"; action = "vfolder-from-query"; }
{ map = [ "index" "pager" ]; key = "J"; action = "sidebar-next"; }
{ map = [ "index" "pager" ]; key = "K"; action = "sidebar-prev"; }
{ map = [ "index" "pager" ]; key = "S"; action = "sidebar-open"; }
];
sources = [
mutt-solarized-dark
];
in
''
alternative_order text/enriched text/plain text
${stringifyBinds binds}
# Macros
#{macroSection}
#"source ${pkgs.neomutt}/share/doc/neomutt/vim-keys/vim-keys.rc"
${stringifyOptions settings}
${stringifySources sources}
${mkVirtualMailbox "Inbox" "tag:inbox"}
${lib.concatStringsSep
"\n"
(lib.mapAttrsToList mkVirtualMailbox virtualMailboxes)}
#mailboxes ="==================="
'' + lib.concatMapStringsSep "\n"
(account: with account; ''
# Account ${name}
# FIXME
named-mailboxes "== ${name} ==" +${name}/${folders.inbox}
mailboxes =${name}/${folders.inbox}
mailboxes =${name}/${folders.sent}
mailboxes =${name}/${folders.drafts}
mailboxes =${name}/${folders.trash}
'')
neomuttAccounts;
programs.mbsync.enable = true; programs.mbsync.enable = true;
programs.msmtp.enable = true; programs.msmtp.enable = true;
#programs.mu.enable = true;
programs.notmuch = { programs.notmuch = {
enable = true; enable = true;
hooks = { hooks = {