diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-10-15 20:24:24 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-10-15 20:24:24 +0000 |
commit | de27852f4f7c3ab53e5bc19b4b619dcff6cf1b4f (patch) | |
tree | d1b1162a54f53abd03847779f580739dfb689342 /modules/workstation/mail/postfix/default.nix | |
parent | 7ef530000efea9173bf10b687ecd895625c1958c (diff) | |
download | nixlib-de27852f4f7c3ab53e5bc19b4b619dcff6cf1b4f.tar nixlib-de27852f4f7c3ab53e5bc19b4b619dcff6cf1b4f.tar.gz nixlib-de27852f4f7c3ab53e5bc19b4b619dcff6cf1b4f.tar.bz2 nixlib-de27852f4f7c3ab53e5bc19b4b619dcff6cf1b4f.tar.lz nixlib-de27852f4f7c3ab53e5bc19b4b619dcff6cf1b4f.tar.xz nixlib-de27852f4f7c3ab53e5bc19b4b619dcff6cf1b4f.tar.zst nixlib-de27852f4f7c3ab53e5bc19b4b619dcff6cf1b4f.zip |
modules/mail: replace msmtp with postfix
Using a full MTA might seem like overkill, but it fixes my biggest annoyance with msmtp -- not only can I now read mail while offline, I can send it too, and postfix will just keep trying every so often until it sends (or five days have passed, but at that point the message is probably irrelevant anyway). Postfix's defaults are surprisingly good for this use case. The longest it will wait between attempts is 4000 seconds, and it'll keep trying for five days before giving up and bouncing.
Diffstat (limited to 'modules/workstation/mail/postfix/default.nix')
-rw-r--r-- | modules/workstation/mail/postfix/default.nix | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/workstation/mail/postfix/default.nix b/modules/workstation/mail/postfix/default.nix new file mode 100644 index 000000000000..6741abb96cdf --- /dev/null +++ b/modules/workstation/mail/postfix/default.nix @@ -0,0 +1,26 @@ +{ pkgs, lib, config, ... }: + +{ + services.postfix.enable = true; + + services.postfix.hostname = with lib; with config.networking; + concatStringsSep "." (filter (x: x != null) [ hostName domain ]); + + services.postfix.relayHost = "smtp.fastmail.com"; + services.postfix.relayPort = 465; + + # NixOS links /var/lib/postfix/conf to /etc/postfix, but + # postfix.service deletes /var/lib/postfix in an ExecStartPre, so we + # can't keep files there without adding them to the store. + # + # Work around this with a layer of symlink indirection. + services.postfix.mapFiles.sasl_passwd = pkgs.runCommand "sasl_passwd" {} '' + ln -s /var/lib/postfix/sasl_passwd $out + ''; + services.postfix.config.smtp_sasl_password_maps = "hash:/etc/postfix/sasl_passwd"; + + services.postfix.config.smtp_sasl_auth_enable = true; + services.postfix.config.smtp_sasl_tls_security_options = "noanonymous"; + services.postfix.config.smtp_tls_security_level = "encrypt"; + services.postfix.config.smtp_tls_wrappermode = true; +} |