WIP: Add neomutt

This commit is contained in:
Simon Bruder 2021-01-18 00:16:08 +01:00
parent 0de6be12f4
commit 342d537621
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
2 changed files with 142 additions and 0 deletions

View file

@ -2,6 +2,7 @@
imports = [ imports = [
./alacritty.nix ./alacritty.nix
./anki ./anki
./email.nix
./games.nix ./games.nix
./ghci.nix ./ghci.nix
./git.nix ./git.nix

View file

@ -0,0 +1,141 @@
{ config, lib, pkgs, ... }:
let
virtualMailboxes = {
"FabLab" = "body:fablab";
"Git" = "from:{.*@github.com or .*@gitlab.com or no-reply+gitea@sbruder.de}'";
};
mkVirtualMailbox = name: searchTerm: ''
virtual-mailboxes "${name}" "notmuch://?query=${searchTerm}"
'';
mutt-solarized-dark = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/altercation/mutt-colors-solarized/b1520c6bf1ab49538439514c9393ff69df8591b4/mutt-colors-solarized-dark-16.muttrc";
sha256 = "0lji8lds9xqj3j5qpn5554rk8gqx72mc6dc57j3j3kb20xvnq5cx";
meta.license = lib.licenses.mit;
};
in
{
accounts.email = {
maildirBasePath = "${config.xdg.dataHome}/mail";
accounts = {
personal = rec {
primary = true;
realName = "Simon Bruder";
address = "simon@sbruder.de";
aliases = [ ]; # FIXME!?
userName = address;
passwordCommand = "pass sbruder.de/account | head -n 1";
imap = {
host = "home.sbruder.de";
tls.useStartTls = true;
};
smtp = {
host = "home.sbruder.de";
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 = {
key = config.programs.gpg.settings.default-key;
signByDefault = true;
encryptByDefault = true;
};
msmtp.enable = true;
mbsync = {
enable = true;
#flatten = ".";
create = "both";
expunge = "both";
};
#mu.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;
};
};
};
programs.neomutt = {
enable = true;
sidebar = {
enable = true;
format = "%B%?F? [%F]?%* %?N?%N/?%S";
};
binds = [
{ map = "index"; key = "\\\\"; action = "vfolder-from-query"; }
];
extraConfig = ''
source ${mutt-solarized-dark}
${mkVirtualMailbox "Inbox" "tag:inbox"}
${lib.concatStringsSep
"\n"
(lib.attrValues
(lib.mapAttrs mkVirtualMailbox virtualMailboxes))}
'';
# somehow makes <Enter> not work (?)
#vimKeys = true;
settings = {
wait_key = "yes";
timeout = "3";
quit = "yes";
mail_check_stats = "yes";
edit_headers = "yes";
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.msmtp.enable = true;
#programs.mu.enable = true;
programs.notmuch = {
enable = true;
hooks = {
preNew = ''
mbsync --all
'';
};
};
}