email: use home-manager configuration options

This commit is contained in:
Benjamin Yule Bädorf 2024-03-26 22:07:02 +01:00
parent dd43281a4a
commit 2924b5d1a0
Signed by: b12f
GPG key ID: 729956E1124F8F26
34 changed files with 245 additions and 600 deletions

View file

@ -256,16 +256,16 @@
]
},
"locked": {
"lastModified": 1702676849,
"narHash": "sha256-XqcREaTS38/QOsN8fk8PP325/UXHyF9enbP5ZPw5aiA=",
"lastModified": 1711133180,
"narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "aa99c2f4e9847cbb7e46fac0844ea1eb164b3b3a",
"rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.11",
"ref": "master",
"repo": "home-manager",
"type": "github"
}
@ -423,11 +423,11 @@
},
"nixpkgs-master": {
"locked": {
"lastModified": 1710871319,
"narHash": "sha256-y30iYkmVpi6o2yCLH8Iz7Bi7XXuNOmCPmxFIdNMW9Og=",
"lastModified": 1711485334,
"narHash": "sha256-qOHrFSfo6W5J5RkkJy7xLSECKaK/NITQXfeh715fD7s=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f4fb648799ae71ac118a2a1c8b92698f2a01e246",
"rev": "e19e9bceda53148e8dd6e8f54bf19375e5e60af9",
"type": "github"
},
"original": {
@ -439,11 +439,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1710806803,
"narHash": "sha256-qrxvLS888pNJFwJdK+hf1wpRCSQcqA6W5+Ox202NDa0=",
"lastModified": 1711333969,
"narHash": "sha256-5PiWGn10DQjMZee5NXzeA6ccsv60iLu+Xtw+mfvkUAs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b06025f1533a1e07b6db3e75151caa155d1c7eb3",
"rev": "57e6b3a9e4ebec5aa121188301f04a6b8c354c9b",
"type": "github"
},
"original": {
@ -487,11 +487,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1710695816,
"narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=",
"lastModified": 1711124224,
"narHash": "sha256-l0zlN/3CiodvWDtfBOVxeTwYSRz93muVbXWSpaMjXxM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "614b4613980a522ba49f0d194531beddbb7220d3",
"rev": "56528ee42526794d413d6f244648aaee4a7b56c0",
"type": "github"
},
"original": {

View file

@ -12,7 +12,7 @@
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";

View file

@ -19,6 +19,7 @@ in {
boot.swraid.mdadmConf = ''
DEVICE /dev/nvme0n1p2 /dev/nvme1n1p2
ARRAY /dev/md/nixos:root metadata=1.2 name=nixos:root UUID=67d1aa81:1b348887:c17a75e8:f2edf2bd
MAILADDR ${psCfg.user.email}
'';
pub-solar.core.hibernation.enable = true;

View file

@ -17,6 +17,7 @@
factorio-headless = master.factorio-headless;
paperless-ngx = master.paperless-ngx;
waybar = master.waybar;
ungoogled-chromium = master.ungoogled-chromium;
adlist = inputs.adblock-unbound.packages.${prev.system};

14
pkgs/check-mail.nix Normal file
View file

@ -0,0 +1,14 @@
self:
with self; ''
${offlineimap}/bin/offlineimap
for dir in ~/Mail/*
do
unread=$(find "''${dir}/INBOX/" -type f | grep -vE ',[^,]*S[^,]*$')
if [ ! -z "''${unread}" ]; then
inbox=$(basename $dir)
${libnotify}/bin/notify-send "''${inbox} has unread mail"
fi
done
''

View file

@ -13,8 +13,7 @@ with prev; {
mu = writeShellScriptBin "mu" (import ./mu.nix final);
p = writeShellScriptBin "p" (import ./p.nix final);
present-md = writeShellScriptBin "present-md" (import ./present-md.nix final);
psos = writeShellScriptBin "psos" (import ./psos.nix final);
psos-docs = import ./psos-docs.nix final;
check-mail = writeShellScriptBin "check-mail" (import ./check-mail.nix final);
s = writeShellScriptBin "s" (import ./s.nix final);
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);
sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final);

View file

@ -1,27 +0,0 @@
self:
with self;
stdenv.mkDerivation rec {
pname = "psos-docs";
version = "0.0.1";
buildInputs = [
mdbook
mdbook-pdf
];
src = ../docs/..; # wut
phases = ["buildPhase" "installPhase"];
buildPhase = ''
cp -r $src/doc ./doc
cp $src/README.md ./README.md
chmod ug+w -R .
ls -la .
mdbook build doc
'';
installPhase = ''
mkdir -p $out/lib/
cp -r doc/book $out/lib/html
'';
}

View file

@ -1,34 +0,0 @@
self:
with self; ''
case $1 in
rebuild)
shift;
exec sudo nixos-rebuild switch --flake "/etc/nixos#installed-host" $@
;;
update)
shift;
cd /etc/nixos
git pull
exec nix flake update
;;
option)
shift;
exec nixos-option -I nixpkgs=/etc/nixos/lib/compat $@
;;
help)
shift;
exec xdg-open http://help.local/
;;
*)
if [[ "$@" != "" ]]; then
echo "Unknown command: psos $@"
echo ""
fi
echo "Usage: psos [COMMAND]"
echo " rebuild Rebuild the configuration and switch to it"
echo " update Pull git and update flake.lock"
echo " option [path] See the current value for an option in the flake config. Example: psos option nix.nixPath"
exit 1
;;
esac
''

View file

@ -5,12 +5,15 @@ with self; ''
current_layout=$(${sway}/bin/swaymsg -t get_inputs | ${jq}/bin/jq -r '.[] | select(.type == "keyboard") | .xkb_active_layout_index' | head -1)
total_layouts=$(${sway}/bin/swaymsg -t get_inputs | ${jq}/bin/jq -r '.[] | select(.type == "keyboard") | .xkb_layout_names | length' | head -1)
next_layout=$(expr $current_layout + 1);
next_layout_index=$(expr $current_layout + 1);
if [ $next_layout -ge $total_layouts ]; then
next_layout=0;
if [ $next_layout_index -ge $total_layouts ]; then
next_layout_index=0;
fi
${sway}/bin/swaymsg input '*' xkb_switch_layout "$next_layout_index"
echo $next_layout_index
next_layout=$(${sway}/bin/swaymsg -t get_inputs | ${jq}/bin/jq -r "[ .[] | select(.type == \"keyboard\") | .xkb_layout_names ][0].[$next_layout_index]")
${libnotify}/bin/notify-send "$next_layout"
${sway}/bin/swaymsg input '*' xkb_switch_layout "$next_layout"
''

View file

@ -15,7 +15,7 @@ in {
./ssh.nix
./concepts-and-training.nix
./ehex.nix
./email
./email.nix
];
config = {

206
users/b12f/email.nix Normal file
View file

@ -0,0 +1,206 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
psCfg = config.pub-solar;
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
configHome = xdg.configHome;
cacheHome = xdg.cacheHome;
generateMailAccount = args@{ address, ... }: rec {
inherit address;
realName = psCfg.user.fullName;
signature = {
showSignature = "append";
text = builtins.readFile (./.config/neomutt + "/${address}.signature");
};
folders = {
inbox = "INBOX";
drafts = "Drafts";
sent = "Sent";
trash = "Trash";
};
gpg.key = psCfg.user.gpgKeyId;
userName = address;
passwordCommand = "secret-tool lookup email ${address}";
imap = {
host = mkIf (args ? "host") args.host;
port = 993;
};
smtp = {
host = mkIf (args ? "host") args.host;
port = 587;
tls.useStartTls = true;
};
imapnotify = {
enable = true;
boxes = [ "INBOX" ];
onNotifyPost = "${pkgs.libnotify}/bin/notify-send '${address} has new mail'";
};
msmtp.enable = true;
neomutt = {
enable = true;
sendMailCommand = "msmtp -a ${address}";
extraConfig = ''
set pgp_default_key="${gpg.key}"
mailboxes +INBOX \
+Drafts \
+Sent \
+Archive \
+Trash
'';
};
offlineimap.enable = true;
} // (if args ? "config" then args.config else {});
in {
users.users."${psCfg.user.name}".packages = with pkgs; [
w3m
mailto-mutt
check-mail
];
home-manager.users."${psCfg.user.name}" = rec {
xdg.configFile."neomutt/base16.muttrc".source = ./.config/neomutt/base16.muttrc;
xdg.configFile."neomutt/mailcap".source = ./.config/neomutt/mailcap;
accounts.email = {
maildirBasePath = "/home/${psCfg.user.name}/Mail";
accounts = lib.lists.foldr (item: set: (set // { "${item.address}" = generateMailAccount item; })) {} [
{
address = "hello@benjaminbaedorf.eu";
host = "mail.hosting.de";
config.primary = true;
}
{
address = "mail@b12f.io";
host = "mail.b12f.io";
}
{
address = "benjamin.baedorf@rwth-aachen.de";
host = "mail.rwth-aachen.de";
config.userName = "bb564306@rwth-aachen.de";
}
{
address = "byb@miom.space";
host = "mail.hosting.de";
}
{
address = "admins@pub.solar";
host = "mail.greenbaum.zone";
}
{
address = "crew@pub.solar";
host = "mail.greenbaum.zone";
}
{
address = "benjamin.yule.baedorf@verkstedt.com";
flavor = "gmail";
config = {
smtp.host = "smtp.gmail.com";
imap.host = "imap.gmail.com";
};
}
{
address = "benjamin-yule.baedorf@ext.ehealthexperts.de";
config = {
smtp.host = "smtp.mailbox.org";
imap.host = "imap.mailbox.org";
};
}
];
};
programs.offlineimap.enable = true;
programs.msmtp.enable = true;
programs.neomutt = {
enable = true;
binds = [
# Moving around
{ map = ["generic"]; key = "g"; action = "noop"; }
{ map = ["generic"]; key = "gg"; action = "first-entry"; }
{ map = ["generic" "index"]; key = "G"; action = "last-entry"; }
{ map = ["generic" "index"]; key = "i"; action = "previous-entry"; }
{ map = ["generic" "index"]; key = "k"; action = "next-entry"; }
{ map = ["pager" "index"]; key = "d"; action = "noop"; }
{ map = ["pager" "index"]; key = "dd"; action = "delete-message"; }
{ map = ["pager"]; key = "i"; action = "previous-line"; }
{ map = ["pager"]; key = "k"; action = "next-line"; }
{ map = ["pager"]; key = "I"; action = "previous-entry"; }
{ map = ["pager"]; key = "K"; action = "next-entry"; }
{ map = ["pager"]; key = "r"; action = "noop"; }
{ map = ["pager"]; key = "rr"; action = "reply"; }
{ map = ["pager"]; key = "ra"; action = "group-reply"; }
{ map = ["pager"]; key = "rn"; action = "group-chat-reply"; }
{ map = ["pager"]; key = "rl"; action = "list-reply"; }
# Threads
{ map = ["browser" "pager" "index"]; key = "N"; action = "search-opposite"; }
{ map = ["pager" "index"]; key = "dT"; action = "delete-thread"; }
{ map = ["pager" "index"]; key = "dt"; action = "delete-subthread"; }
{ map = ["pager" "index"]; key = "g"; action = "noop"; }
{ map = ["pager" "index"]; key = "gt"; action = "next-thread"; }
{ map = ["pager" "index"]; key = "gT"; action = "previous-thread"; }
{ map = ["index"]; key = "za"; action = "collapse-thread"; }
{ map = ["index"]; key = "zA"; action = "collapse-all"; }
];
macros = [
# Enable URL opening
{
map = ["index" "pager"];
key = "\\Cb";
action = ''<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message'';
}
{
map = ["attach" "compose"];
key = "\\Cb";
action = ''<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message'';
}
# Translate markdown to html
{
map = ["compose"];
key = "\\e5";
action = ''F pandoc -s -f markdown -t html \ny^T^Utext/html; charset=utf-8\n'';
}
# Save to ~/Downloads by default
{
map = ["attach"];
key = "S";
action = ''<save-entry><bol>~/Downloads/<eol>" "Save to Downloads'';
}
] ++ lib.lists.imap1 (i: address: {
map = ["index" "pager"];
key = "<F${builtins.toString i}>";
action = ''<sync-mailbox><enter-command>source ${configHome}/neomutt/${address}<enter><change-folder>!<enter>'';
}) (builtins.attrNames accounts.email.accounts);
unmailboxes = true;
extraConfig = ''
source ${configHome}/neomutt/base16.muttrc
# HTML emails
auto_view text/html # view html automatically
alternative_order text/plain text/enriched text/html # save html for last
'';
settings = {
sendmail_wait = "0";
crypt_verify_sig = "yes";
imap_check_subscribed = "yes";
date_format = ''"!%d.%m.%Y %H:%M"'';
index_format = ''"%4C %Z %D %4c %20.20L %s"'';
mailcap_path = "${configHome}/neomutt/mailcap";
};
};
};
}

View file

@ -1,63 +0,0 @@
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account hello@benjaminbaedorf.eu
host mail.hosting.de
port 587
protocol smtp
from hello@benjaminbaedorf.eu
user hello@benjaminbaedorf.eu
account benjamin.baedorf@rwth-aachen.de
host mail.rwth-aachen.de
port 587
protocol smtp
from benjamin.baedorf@rwth-aachen.de
user bb564306@rwth-aachen.de
account byb@miom.space
host mail.hosting.de
port 587
protocol smtp
from byb@miom.space
user byb@miom.space
account admins@pub.solar
host mail.greenbaum.zone
port 587
protocol smtp
from admins@pub.solar
user admins@pub.solar
account crew@pub.solar
host mail.greenbaum.zone
port 587
protocol smtp
from crew@pub.solar
user crew@pub.solar
account mail@b12f.io
host mail.b12f.io
port 587
protocol smtp
from mail@b12f.io
user mail@b12f.io
account benjamin.yule.baedorf@verkstedt.com
host smtp.gmail.com
port 587
protocol smtp
from benjamin.yule.baedorf@verkstedt.com
user benjamin.yule.baedorf@verkstedt.com
account benjamin-yule.baedorf@ext.ehealthexperts.de
host smtp.mailbox.org
port 587
protocol smtp
from benjamin-yule.baedorf@ext.ehealthexperts.de
user benjamin-yule.baedorf@ext.ehealthexperts.de
account default : hello@benjaminbaedorf.eu

View file

@ -1,21 +0,0 @@
# vim: filetype=muttrc
set from = "pub.solar Admins <admins@pub.solar>"
set sendmail = "msmtp -a admins@pub.solar"
set signature = "~/.config/mutt/admins@pub.solar.signature"
set pgp_default_key="8A8987ADE3736C8CA2EB315A9B809EBBDD62BAE3"
set mbox_type = Maildir
set folder = ~/Mail
set spoolfile = "+admins\@pub.solar/INBOX"
set postponed = "+admins\@pub.solar/Drafts"
set record = "+admins\@pub.solar/Sent"
set trash = "+admins\@pub.solar/Trash"
mbox-hook = "+admins\@pub.solar/Archive"
unmailboxes *
mailboxes +admins\@pub.solar/INBOX \
+admins\@pub.solar/Drafts \
+admins\@pub.solar/Sent \
+admins\@pub.solar/Archive \
+admins\@pub.solar/Trash

View file

@ -1,24 +0,0 @@
# vim: filetype=muttrc
set from = "Yule Bädorf <benjamin-yule.baedorf@ext.ehealthexperts.de>"
set sendmail = "msmtp -a benjamin-yule.baedorf@ext.ehealthexperts.de"
set signature = "~/.config/mutt/benjamin-yule.baedorf@ext.ehealthexperts.de.signature"
set pgp_default_key="8A8987ADE3736C8CA2EB315A9B809EBBDD62BAE3"
set imap_user = benjamin-yule.baedorf@ext.ehealthexperts.de
set imap_pass = `secret-tool lookup service smtp host smtp.mailbox.org user benjamin-yule.baedorf@ext.ehealthexperts.de`
set folder = imaps://imap.mailbox.org:993
set spoolfile = "+INBOX"
set postponed = "+Drafts"
set record = "+Sent"
set trash = "+Trash"
mbox-hook = "+Archive"
unmailboxes *
mailboxes +INBOX \
+Drafts \
+Sent \
+Archive \
+Trash

View file

@ -1,21 +0,0 @@
# vim: filetype=muttrc
set from = "Benjamin Bädorf <benjamin.baedorf@rwth-aachen.de>"
set sendmail = "msmtp -a benjamin.baedorf@rwth-aachen.de"
set signature = "~/.config/mutt/hello@benjaminbaedorf.eu.signature"
set pgp_default_key="FC623BBCBD2604D5CC9D90BAE77B0AAAF0D9B76B"
set mbox_type = Maildir
set folder = ~/Mail
set spoolfile = "+benjamin.baedorf\@rwth-aachen.de/INBOX"
set postponed = "+benjamin.baedorf\@rwth-aachen.de/Drafts"
set record = "+benjamin.baedorf\@rwth-aachen.de/Sent"
set trash = "+benjamin.baedorf\@rwth-aachen.de/Trash"
mbox-hook = "+benjamin.baedorf\@rwth-aachen.de/Journal"
unmailboxes *
mailboxes +benjamin.baedorf\@rwth-aachen.de/INBOX \
+benjamin.baedorf\@rwth-aachen.de/Drafts \
+benjamin.baedorf\@rwth-aachen.de/Sent \
+benjamin.baedorf\@rwth-aachen.de/Journal \
+benjamin.baedorf\@rwth-aachen.de/Trash

View file

@ -1,32 +0,0 @@
# vim: filetype=muttrc
set from = "Yule Bädorf <benjamin.yule.baedorf@verkstedt.com>"
set sendmail = "msmtp -a benjamin.yule.baedorf@verkstedt.com"
set signature = "~/.config/mutt/benjamin.yule.baedorf@verkstedt.com.signature"
set pgp_default_key="8A8987ADE3736C8CA2EB315A9B809EBBDD62BAE3"
set imap_user = benjamin.yule.baedorf@verkstedt.com
set imap_pass = `secret-tool lookup service smtp host smtp.gmail.com user benjamin.yule.baedorf@verkstedt.com`
# My mailboxes
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
set folder = imaps://imap.mailbox.org:993
set spoolfile = "+INBOX"
set postponed = "+Drafts"
set record = "+Sent"
set trash = "+Trash"
mbox-hook = "+Archive"
unmailboxes *
mailboxes +INBOX \
+Drafts \
+Sent \
+Archive \
+Trash

View file

@ -1,21 +0,0 @@
# vim: filetype=muttrc
set from = "Benjamin Bädorf <byb@miom.space>"
set sendmail = "msmtp -a byb@miom.space"
set signature = "~/.config/mutt/byb@miom.space.signature"
set pgp_default_key="FC623BBCBD2604D5CC9D90BAE77B0AAAF0D9B76B"
set mbox_type = Maildir
set folder = ~/Mail
set spoolfile = "+byb\@miom.space/INBOX"
set postponed = "+byb\@miom.space/Drafts"
set record = "+byb\@miom.space/Sent"
set trash = "+byb\@miom.space/Trash"
mbox-hook = "+byb\@miom.space/Archive"
unmailboxes *
mailboxes +byb\@miom.space/INBOX \
+byb\@miom.space/Drafts \
+byb\@miom.space/Sent \
+byb\@miom.space/Archive \
+byb\@miom.space/Trash

View file

@ -1,21 +0,0 @@
# vim: filetype=muttrc
set from = "pub.solar crew <crew@pub.solar>"
set sendmail = "msmtp -a crew@pub.solar"
set signature = "~/.config/mutt/crew@pub.solar.signature"
set pgp_default_key="8A8987ADE3736C8CA2EB315A9B809EBBDD62BAE3"
set mbox_type = Maildir
set folder = ~/Mail
set spoolfile = "+crew\@pub.solar/INBOX"
set postponed = "+crew\@pub.solar/Drafts"
set record = "+crew\@pub.solar/Sent"
set trash = "+crew\@pub.solar/Trash"
mbox-hook = "+crew\@pub.solar/Archive"
unmailboxes *
mailboxes +crew\@pub.solar/INBOX \
+crew\@pub.solar/Drafts \
+crew\@pub.solar/Sent \
+crew\@pub.solar/Archive \
+crew\@pub.solar/Trash

View file

@ -1,21 +0,0 @@
# vim: filetype=muttrc
set from = "Benjamin Bädorf <hello@benjaminbaedorf.eu>"
set sendmail = "msmtp -a hello@benjaminbaedorf.eu"
set signature = "~/.config/mutt/hello@benjaminbaedorf.eu.signature"
set pgp_default_key="FC623BBCBD2604D5CC9D90BAE77B0AAAF0D9B76B"
set mbox_type = Maildir
set folder = ~/Mail
set spoolfile = "+hello\@benjaminbaedorf.eu/INBOX"
set postponed = "+hello\@benjaminbaedorf.eu/Drafts"
set record = "+hello\@benjaminbaedorf.eu/Sent"
set trash = "+hello\@benjaminbaedorf.eu/Trash"
mbox-hook = "+hello\@benjaminbaedorf.eu/Archive"
unmailboxes *
mailboxes +hello\@benjaminbaedorf.eu/INBOX \
+hello\@benjaminbaedorf.eu/Drafts \
+hello\@benjaminbaedorf.eu/Sent \
+hello\@benjaminbaedorf.eu/Archive \
+hello\@benjaminbaedorf.eu/Trash

View file

@ -1,21 +0,0 @@
# vim: filetype=muttrc
set from = "Benjamin Bädorf <mail@b12f.io>"
set sendmail = "msmtp -a mail@b12f.io"
set signature = "~/.config/mutt/mail@b12f.io.signature"
set pgp_default_key="FC623BBCBD2604D5CC9D90BAE77B0AAAF0D9B76B"
set mbox_type = Maildir
set folder = ~/Mail
set spoolfile = "+mail\@b12f.io/INBOX"
set postponed = "+mail\@b12f.io/Drafts"
set record = "+mail\@b12f.io/Sent"
set trash = "+mail\@b12f.io/Trash"
mbox-hook = "+mail\@b12f.io/Archive"
unmailboxes *
mailboxes +mail\@b12f.io/INBOX \
+mail\@b12f.io/Drafts \
+mail\@b12f.io/Sent \
+mail\@b12f.io/Archive \
+mail\@b12f.io/Trash

View file

@ -1,104 +0,0 @@
# vim: filetype=muttrc
source $XDG_CONFIG_HOME/mutt/base16.muttrc
source $XDG_CONFIG_HOME/mutt/accounts.muttrc
set editor = `echo \$EDITOR`
set sidebar_visible = yes
set sidebar_width = 50
set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S"
set sendmail_wait = 0
set mail_check_stats
set crypt_use_gpgme=yes
set crypt_autosign=yes
set crypt_verify_sig=yes
set crypt_replysign=yes
set crypt_replyencrypt=yes
set crypt_replysignencrypted=yes
set crypt_autoencrypt=yes
set pgp_check_gpg_decrypt_status_fd
set pgp_use_gpg_agent=yes
set pgp_self_encrypt=yes
# Store message headers locally to speed things up.
# If hcache is a folder, Mutt will create sub cache folders for each account which may speeds things up even more.
set header_cache = $XDG_CACHE_HOME/mutt
# Store messages locally to speed things up, like searching message bodies.
# Can be the same folder as header_cache.
# This will cost important disk usage according to your e-mail amount.
set message_cachedir = $XDG_CACHE_HOME/mutt
set imap_check_subscribed
# Allow Mutt to open a new IMAP connection automatically.
unset imap_passive
# Keep the IMAP connection alive by polling intermittently (time in seconds).
set imap_keepalive = 300
# How often to check for new mail (time in seconds).
set mail_check = 120
set askcc
set askbcc
set date_format="!%d.%m.%Y %H:%M"
set index_format="%4C %Z %D %4c %20.20L %s"
#------------------------------------------------------------
# Vi Key Bindings
#------------------------------------------------------------
# Moving around
bind generic g noop
bind generic gg first-entry
bind generic,index G last-entry
bind generic,index i previous-entry
bind generic,index k next-entry
bind pager,index d noop
bind pager,index dd delete-message
bind pager i previous-line
bind pager k next-line
bind pager I previous-entry
bind pager K next-entry
bind pager r noop
bind pager rr reply
bind pager ra group-reply
bind pager rn group-chat-reply
bind pager rl list-reply
# Threads
bind browser,pager,index N search-opposite
bind pager,index dT delete-thread
bind pager,index dt delete-subthread
bind pager,index g noop
bind pager,index gt next-thread
bind pager,index gT previous-thread
bind index za collapse-thread
bind index zA collapse-all # Missing :folddisable/foldenable
# Enable URL opening
macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message"
macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message"
# Translate markdown to html
macro compose \e5 "F pandoc -s -f markdown -t html \ny^T^Utext/html; charset=utf-8\n"
set wait_key=no
# Save to ~/Downloads by default
macro attach D "<save-entry><bol>~/Downloads/<eol>" "Save to Downloads"
set mailcap_path = $XDG_CONFIG_HOME/mutt/mailcap
# HTML emails
auto_view text/html # view html automatically
alternative_order text/plain text/enriched text/html # save html for last

View file

@ -1,100 +0,0 @@
[general]
pythonfile = $XDG_CONFIG_HOME/offlineimap/functions.py
metadata = $XDG_DATA_HOME/offlineimap
accounts = BBEU, MiOM, b12f, RWTH, AdminsPubSolar, CrewPubSolar
[Account BBEU]
localrepository = LocalBBEU
remoterepository = RemoteBBEU
[Repository LocalBBEU]
type = Maildir
localfolders = ~/Mail/hello@benjaminbaedorf.eu
[Repository RemoteBBEU]
type = IMAP
remotehost = mail.hosting.de
remoteuser = hello@benjaminbaedorf.eu
remotepasseval = get_secret("service", "smtp", "host", "mail.hosting.de", "user", "hello@benjaminbaedorf.eu")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
[Account MiOM]
localrepository = LocalMiOM
remoterepository = RemoteMiOM
[Repository LocalMiOM]
type = Maildir
localfolders = ~/Mail/byb@miom.space
[Repository RemoteMiOM]
type = IMAP
remotehost = mail.hosting.de
remoteuser = byb@miom.space
remotepasseval = get_secret("service", "smtp", "host", "mail.hosting.de", "user", "byb@miom.space")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
[Account AdminsPubSolar]
localrepository = LocalAdminsPubSolar
remoterepository = RemoteAdminsPubSolar
[Repository LocalAdminsPubSolar]
type = Maildir
localfolders = ~/Mail/admins@pub.solar
[Repository RemoteAdminsPubSolar]
type = IMAP
remotehost = mail.greenbaum.zone
remoteport = 993
remoteuser = admins@pub.solar
remotepasseval = get_secret("service", "smtp", "host", "mail.greenbaum.zone", "user", "admins@pub.solar")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
ssl = yes
[Account CrewPubSolar]
localrepository = LocalCrewPubSolar
remoterepository = RemoteCrewPubSolar
[Repository LocalCrewPubSolar]
type = Maildir
localfolders = ~/Mail/crew@pub.solar
[Repository RemoteCrewPubSolar]
type = IMAP
remotehost = mail.greenbaum.zone
remoteport = 993
remoteuser = crew@pub.solar
remotepasseval = get_secret("service", "smtp", "host", "mail.greenbaum.zone", "user", "crew@pub.solar")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
ssl = yes
[Account b12f]
localrepository = Localb12f
remoterepository = Remoteb12f
[Repository Localb12f]
type = Maildir
localfolders = ~/Mail/mail@b12f.io
[Repository Remoteb12f]
type = IMAP
remotehost = mail.b12f.io
remoteuser = mail@b12f.io
remoteport = 993
remotepasseval = get_secret("service", "smtp", "host", "mail.b12f.io", "user", "mail@b12f.io")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
ssl = yes
[Account RWTH]
localrepository = LocalRWTH
remoterepository = RemoteRWTH
[Repository LocalRWTH]
type = Maildir
localfolders = ~/Mail/benjamin.baedorf@rwth-aachen.de
[Repository RemoteRWTH]
type = IMAP
remotehost = mail.rwth-aachen.de
remoteuser = bb564306@rwth-aachen.de
remotepasseval = get_secret("service", "smtp", "host", "mail.rwth-aachen.de", "user", "bb564306@rwth-aachen.de")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

View file

@ -1,9 +0,0 @@
#! /usr/bin/env python2
import os
import subprocess
def get_env(key):
return os.getenv(key)
def get_secret(*attributes):
return subprocess.check_output(["secret-tool", "lookup"] + list(attributes))

View file

@ -1,60 +0,0 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
psCfg = config.pub-solar;
in {
users.users."${psCfg.user.name}".packages = with pkgs; [
w3m
urlscan
neomutt
offlineimap
msmtp
mailto-mutt
];
home-manager.users."${psCfg.user.name}" = {
programs.offlineimap = {
enable = true;
pythonFile = builtins.readFile ./.config/offlineimap/functions.py;
};
xdg.configFile."mutt/muttrc".source = ./.config/mutt/muttrc;
xdg.configFile."mutt/base16.muttrc".source = ./.config/mutt/base16.muttrc;
xdg.configFile."mutt/mailcap".source = ./.config/mutt/mailcap;
xdg.configFile."offlineimap/functions.py".source = ./.config/offlineimap/functions.py;
xdg.configFile."mutt/accounts.muttrc".text = ''
source ./hello@benjaminbaedorf.eu.muttrc
macro index <f1> '<sync-mailbox><enter-command>source $XDG_CONFIG_HOME/mutt/hello@benjaminbaedorf.eu.muttrc<enter><change-folder>!<enter>'
macro index <f2> '<sync-mailbox><enter-command>source $XDG_CONFIG_HOME/mutt/benjamin.baedorf@rwth-aachen.de.muttrc<enter><change-folder>!<enter>'
macro index <f3> '<sync-mailbox><enter-command>source $XDG_CONFIG_HOME/mutt/byb@miom.space.muttrc<enter><change-folder>!<enter>'
macro index <f4> '<sync-mailbox><enter-command>source $XDG_CONFIG_HOME/mutt/mail@b12f.io.muttrc<enter><change-folder>!<enter>'
macro index <f5> '<sync-mailbox><enter-command>source $XDG_CONFIG_HOME/mutt/admins@pub.solar.muttrc<enter><change-folder>!<enter>'
macro index <f6> '<sync-mailbox><enter-command>source $XDG_CONFIG_HOME/mutt/crew@pub.solar.muttrc<enter><change-folder>!<enter>'
macro index <f7> '<sync-mailbox><enter-command>source $XDG_CONFIG_HOME/mutt/benjamin.yule.baedorf@verkstedt.com.muttrc<enter><change-folder>!<enter>'
macro index <f8> '<sync-mailbox><enter-command>source $XDG_CONFIG_HOME/mutt/benjamin-yule.baedorf@ext.ehealthexperts.de.muttrc<enter><change-folder>!<enter>'
'';
xdg.configFile."mutt/hello@benjaminbaedorf.eu.muttrc".source = ./.config/mutt + "/hello@benjaminbaedorf.eu.muttrc";
xdg.configFile."mutt/benjamin.baedorf@rwth-aachen.de.muttrc".source = ./.config/mutt + "/benjamin.baedorf@rwth-aachen.de.muttrc";
xdg.configFile."mutt/hello@benjaminbaedorf.eu.signature".source = ./.config/mutt + "/hello@benjaminbaedorf.eu.signature";
xdg.configFile."mutt/byb@miom.space.muttrc".source = ./.config/mutt + "/byb@miom.space.muttrc";
xdg.configFile."mutt/byb@miom.space.signature".source = ./.config/mutt + "/byb@miom.space.signature";
xdg.configFile."mutt/mail@b12f.io.muttrc".source = ./.config/mutt + "/mail@b12f.io.muttrc";
xdg.configFile."mutt/mail@b12f.io.signature".source = ./.config/mutt + "/mail@b12f.io.signature";
xdg.configFile."mutt/admins@pub.solar.muttrc".source = ./.config/mutt + "/admins@pub.solar.muttrc";
xdg.configFile."mutt/admins@pub.solar.signature".source = ./.config/mutt + "/admins@pub.solar.signature";
xdg.configFile."mutt/crew@pub.solar.muttrc".source = ./.config/mutt + "/crew@pub.solar.muttrc";
xdg.configFile."mutt/crew@pub.solar.signature".source = ./.config/mutt + "/crew@pub.solar.signature";
xdg.configFile."mutt/benjamin.yule.baedorf@verkstedt.com.muttrc".source = ./.config/mutt + "/benjamin.yule.baedorf@verkstedt.com.muttrc";
xdg.configFile."mutt/benjamin.yule.baedorf@verkstedt.com.signature".source = ./.config/mutt + "/benjamin.yule.baedorf@verkstedt.com.signature";
xdg.configFile."mutt/benjamin-yule.baedorf@ext.ehealthexperts.de.muttrc".source = ./.config/mutt + "/benjamin-yule.baedorf@ext.ehealthexperts.de.muttrc";
xdg.configFile."mutt/benjamin-yule.baedorf@ext.ehealthexperts.de.signature".source = ./.config/mutt + "/benjamin-yule.baedorf@ext.ehealthexperts.de.signature";
xdg.configFile."offlineimap/config".source = ./.config/offlineimap/config;
xdg.configFile."msmtp/config".source = ./.config/msmtp/config;
};
}