era-configuration-nix/mail.nix
2017-05-11 12:35:47 +02:00

63 lines
1.8 KiB
Nix

# Mail stack:
# Display maildirs and read emails -> neomutt
# Write emails -> vim (should already be there)
# Receive emails & synchronize maildir -> mbsync (isync)
# Submit emails to send -> msmtp
# Deal with MIME encoded email packages -> ripmime
# Display HTML emails -> w3m
# Search maildirs -> mu
# Send encrypted email -> gpupg1orig
# and various automation provided by systemd
{ config, pkgs, ... }:
let mu-light = (pkgs.mu.override { withMug = false; }); # no webkit dependency
in
{
environment.systemPackages = with pkgs; [
msmtp
neomutt
ripmime
mu-light
w3m
isync
gnupg1orig
];
systemd.user.services = {
mbsync = {
description = "IMAP mailbox sync";
path = [ pkgs.isync ];
script = "mbsync -c /home/eeva/.mutt/mbsyncrc -q -a";
startAt = "*:0/3";
wantedBy = [ "timers.target" ];
serviceConfig = {
TimeoutStartSec = "2min";
};
preStart = ''
mkdir -p /home/eeva/mail/EEVA
mkdir -p /home/eeva/mail/MPO
mkdir -p /home/eeva/mail/LACL
'';
};
mu = {
description = "Updating mail database";
path = [ mu-light ];
script = "mu index --quiet -m ~/mail";
startAt = "daily";
wantedBy = [ "timers.target" ];
};
msmtp-runqueue = {
description = "Flushing mail queue";
script = builtins.readFile "/home/eeva/prefix/bin/msmtp-runqueue";
preStart = "mkdir -p /home/eeva/.msmtpqueue";
postStop = "rm -f /home/eeva/.msmtpqueue/.lock";
startAt = "*:0/10";
serviceConfig = {
TimeoutStartSec = "2min";
};
path = [ pkgs.msmtp ];
};
};
}