diff options
Diffstat (limited to 'modules/workstation/mail')
-rw-r--r-- | modules/workstation/mail/default.nix | 2 | ||||
-rw-r--r-- | modules/workstation/mail/msmtp/default.nix | 13 | ||||
-rw-r--r-- | modules/workstation/mail/msmtp/msmtprc.in | 20 | ||||
-rw-r--r-- | modules/workstation/mail/postfix/default.nix | 26 |
4 files changed, 27 insertions, 34 deletions
diff --git a/modules/workstation/mail/default.nix b/modules/workstation/mail/default.nix index 4564a2dee1c9..e33b7a702823 100644 --- a/modules/workstation/mail/default.nix +++ b/modules/workstation/mail/default.nix @@ -7,7 +7,7 @@ let in { - imports = [ ./msmtp ./mutt ./notmuch ]; + imports = [ ./mutt ./notmuch ./postfix ]; environment.systemPackages = with pkgs; [ isync ]; diff --git a/modules/workstation/mail/msmtp/default.nix b/modules/workstation/mail/msmtp/default.nix deleted file mode 100644 index 34e23b1d1eb0..000000000000 --- a/modules/workstation/mail/msmtp/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ msmtp ]; - - home.qyliss.dirs."state/msmtp" = {}; - - xdg.config.users.qyliss.paths."msmtp/config" = pkgs.substituteAll { - src = ./msmtprc.in; - inherit (pkgs) gnupg; - tls_trust_file = "/etc/ssl/certs/ca-bundle.crt"; - }; -} diff --git a/modules/workstation/mail/msmtp/msmtprc.in b/modules/workstation/mail/msmtp/msmtprc.in deleted file mode 100644 index ac5da47372f0..000000000000 --- a/modules/workstation/mail/msmtp/msmtprc.in +++ /dev/null @@ -1,20 +0,0 @@ -defaults -auth on -tls on -tls_trust_file @tls_trust_file@ - -account work -host smtp.gmail.com -port 587 -from alyssa.ross@freeagent.com -user alyssa.ross@freeagent.com - -account personal -host smtp.fastmail.com -port 465 -tls_starttls off -from hi@alyssa.is -user alyssa@fastmail.com -passwordeval @gnupg@/bin/gpg --no-tty -q -d ~/state/msmtp/smtppass.gpg - -account default : personal 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; +} |