WIP: neomutt #31
|
@ -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 ];
|
||||||
|
xdg.configFile."neomutt/neomuttrc".text =
|
||||||
|
let
|
||||||
|
# adapted from home-manager
|
||||||
|
stringifyValue = value:
|
||||||
|
if lib.isBool value
|
||||||
|
then (if value then "yes" else "no")
|
||||||
|
else "'${toString value}'";
|
||||||
|
stringifySetOption = option: value:
|
||||||
|
if value == null
|
||||||
|
then "unset ${option}"
|
||||||
|
else "set ${option}=${stringifyValue value}";
|
||||||
|
stringifyOptions = options: lib.concatStringsSep
|
||||||
|
"\n"
|
||||||
|
(lib.mapAttrsToList stringifySetOption options);
|
||||||
|
|
||||||
sidebar = {
|
stringifyBinds = binds: lib.concatMapStringsSep
|
||||||
enable = true;
|
"\n"
|
||||||
format = "%B%?F? [%F]?%* %?N?%N/?%S";
|
(bind:
|
||||||
};
|
let map' =
|
||||||
|
if (lib.isList bind.map)
|
||||||
|
then (lib.concatStringsSep "," bind.map)
|
||||||
|
else bind.map;
|
||||||
|
in
|
||||||
|
''bind ${map'} ${bind.key} "${bind.action}"'')
|
||||||
|
binds;
|
||||||
|
|
||||||
binds = [
|
stringifySources = files: lib.concatMapStringsSep
|
||||||
{ map = "index"; key = "\\\\"; action = "vfolder-from-query"; }
|
"\n"
|
||||||
];
|
(file: "source ${file}")
|
||||||
|
files;
|
||||||
|
|
||||||
extraConfig = ''
|
neomuttAccounts = lib.filter (a: a.neomutt.enable) (lib.attrValues config.accounts.email.accounts);
|
||||||
source ${mutt-solarized-dark}
|
|
||||||
|
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
|
||||||
|
'';
|
||||||
|
|
||||||
|
# notmuch
|
||||||
|
nm_default_uri = "notmuch:///home/simon/.local/share/mail";
|
||||||
|
|
||||||
|
mailcap_path = pkgs.writeText "mutt-mailcap" ''
|
||||||
|
text/html; firefox %s
|
||||||
|
text/html; ${pkgs.w3m}/bin/w3m -I %{charset} -T text/html -dump; copiousoutput;
|
||||||
|
application/pdf; zathura %s
|
||||||
|
image/*; mpv %s
|
||||||
|
'';
|
||||||
|
|
||||||
|
pgp_default_key = config.programs.gpg.settings.default-key;
|
||||||
|
|
||||||
|
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"}
|
${mkVirtualMailbox "Inbox" "tag:inbox"}
|
||||||
${lib.concatStringsSep
|
${lib.concatStringsSep
|
||||||
"\n"
|
"\n"
|
||||||
(lib.attrValues
|
(lib.mapAttrsToList mkVirtualMailbox virtualMailboxes)}
|
||||||
(lib.mapAttrs mkVirtualMailbox virtualMailboxes))}
|
#mailboxes ="==================="
|
||||||
'';
|
'' + lib.concatMapStringsSep "\n"
|
||||||
|
(account: with account; ''
|
||||||
# somehow makes <Enter> not work (?)
|
# Account ${name}
|
||||||
#vimKeys = true;
|
# FIXME
|
||||||
settings = {
|
named-mailboxes "== ${name} ==" +${name}/${folders.inbox}
|
||||||
wait_key = "yes";
|
mailboxes =${name}/${folders.inbox}
|
||||||
timeout = "3";
|
mailboxes =${name}/${folders.sent}
|
||||||
quit = "yes";
|
mailboxes =${name}/${folders.drafts}
|
||||||
mail_check_stats = "yes";
|
mailboxes =${name}/${folders.trash}
|
||||||
|
'')
|
||||||
edit_headers = "yes";
|
neomuttAccounts;
|
||||||
reverse_name = "yes";
|
|
||||||
include = "yes";
|
|
||||||
|
|
||||||
mailcap_path = toString (pkgs.writeText "mutt-mailcap" ''
|
|
||||||
text/html; firefox %s
|
|
||||||
text/html; ${pkgs.w3m}/bin/w3m -I %{charset} -T text/html -dump; copiousoutput;
|
|
||||||
application/pdf; zathura %s
|
|
||||||
image/*; mpv %s
|
|
||||||
'');
|
|
||||||
|
|
||||||
pgp_default_key = config.programs.gpg.settings.default-key;
|
|
||||||
|
|
||||||
nm_query_type = "threads";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
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 = {
|
||||||
|
|
Loading…
Reference in a new issue