nixos-config/mastus/mail.nix

61 lines
1.5 KiB
Nix

{ config, pkgs, ... }:
{
# services.opensmtpd = {
# enable = true;
# serverConfiguration = ''
# listen on 0.0.0.0
# filter sa spamassassin "-s accept"
# accept for any deliver to lmtp localhost:24
# '';
# procPackages = [ pkgs.opensmtpd-extras ];
# };
services.postfix = {
enable = true;
postmasterAlias = "gebner";
rootAlias = "gebner";
extraAliases = ''
ge: gebner
cutintro: gebner
'';
hostname = "mastus.gebner.org";
sslCACert = "/etc/sslcerts/startssl.cert";
sslCert = "/etc/sslcerts/mail.cert";
sslKey = "/etc/sslcerts/mail.key";
destination = [ "gebner.org" "gabrielebner.at" "2b7e.org"
"mastus.gebner.org" "mail.gebner.org" "localhost" ];
extraConfig = ''
mailbox_command = ${pkgs.procmail}/bin/procmail
'';
};
services.dovecot2 = {
enable = true;
enablePop3 = false;
mailLocation = "maildir:~/mail";
sslCACert = "/etc/sslcerts/startssl.cert";
sslServerCert = "/etc/sslcerts/mail.cert";
sslServerKey = "/etc/sslcerts/mail.key";
};
services.spamassassin.enable = true;
systemd.services.setupSpamassassin = {
wantedBy = [ "spamd.service" ];
after = [ "network.target" ];
path = [ pkgs.spamassassin ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
};
script = ''
if [ ! -d /etc/spamassassin ]; then
cp -rv ${pkgs.spamassassin}/share/spamassassin /etc/
sa-update
fi
'';
};
}