era-configuration-nix/mail.nix
2017-03-18 13:58:50 +01:00

54 lines
1.4 KiB
Nix

# Mail stack:
# Display maildirs and read emails -> neomutt
# Write emails -> vim (should already be there)
# Receive emails & synchronize maildir -> offlineimap
# Submit emails to send -> msmtp
# Deal with MIME encoded email packages -> ripmime
# Display HTML emails -> w3m
# Search maildirs -> mu
# 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
];
services.offlineimap = {
enable = true;
onCalendar = "*:0/5";
};
systemd.user.services = {
mu = {
description = "Updating mail database";
path = [ mu-light ];
script = "mu index --quiet -m ~/mail";
startAt = "daily";
wantedBy = [ "timers.target" ];
};
offlineimap-fast = {
description = "Quick mail synchronization";
path = [ pkgs.offlineimap ];
script = "offlineimap -u quiet -q";
};
msmtp-runqueue = {
description = "Flushing mail queue";
script = builtins.readFile "/home/eeva/prefix/bin/msmtp-runqueue";
preStart = "mkdir -p /home/eeva/.msmtpqueue";
startAt = "*:0/10";
serviceConfig = {
Restart = "on-failure";
};
path = [ pkgs.msmtp ];
};
};
}