From 05b3bba25fe8818647afb7f895b5923b4d09ddba Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Sun, 7 Jul 2024 16:40:50 +0200 Subject: use opensmtpd --- common.nix | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/common.nix b/common.nix index e28fce7..609d260 100644 --- a/common.nix +++ b/common.nix @@ -334,12 +334,14 @@ in libreoffice libva-utils lsof + mailutils mc micro pkgs.kdePackages.neochat nixos-install-tools nmap nvme-cli + procmail okteta pkgs.kdePackages.okular p7zip @@ -459,24 +461,27 @@ in # dconf is needed for gtk, see https://nixos.wiki/wiki/KDE programs.dconf.enable = true; - # ensure cron and Co. can send mails - programs.msmtp = { + # ensure machine can send mails + services.opensmtpd = { enable = true; setSendmail = true; - accounts = { - default = { - auth = true; - tls = true; - from = "christoph@cullmann.io"; - host = "moon.babylon2k.com"; - port = "587"; - user = builtins.readFile "/data/nixos/mailuser.secret"; - passwordeval = "cat /data/nixos/mailpassword.secret"; - }; - }; - defaults = { - aliases = "/etc/aliases"; - }; + serverConfiguration = '' + table aliases file:/etc/mail/aliases + table secrets file:/etc/mail/secrets + listen on lo + action "local" mda "procmail -f -" virtual + action "relay" relay host smtps://smtp@moon.babylon2k.com auth mail-from bot@cullmann.io + match for local action "local" + match for any action "relay" + ''; + }; + environment.etc."mail/aliases" = { + text = "@ christoph@cullmann.io"; + mode = "0400"; + }; + environment.etc."mail/secrets" = { + text = builtins.readFile "/data/nixos/mail.secret"; + mode = "0400"; }; # send mails on ZFS events @@ -484,7 +489,7 @@ in settings = { ZED_DEBUG_LOG = "/tmp/zed.debug.log"; ZED_EMAIL_ADDR = [ "root" ]; - ZED_EMAIL_PROG = "${pkgs.msmtp}/bin/msmtp"; + ZED_EMAIL_PROG = "/run/wrappers/bin/sendmail"; ZED_EMAIL_OPTS = "@ADDRESS@"; ZED_NOTIFY_INTERVAL_SECS = 3600; @@ -498,15 +503,6 @@ in enableMail = false; }; - environment.etc = { - "aliases" = { - text = '' - root: christoph@cullmann.io - ''; - mode = "0644"; - }; - }; - # use ZSH per default programs.zsh.enable = true; environment.shells = with pkgs; [ zsh ]; -- cgit v1.2.3