Skip to content

Instantly share code, notes, and snippets.

@WolfangAukang
Created March 24, 2022 21:53
Show Gist options
  • Save WolfangAukang/b45714514cac21d87e6b4dc8b8471eb8 to your computer and use it in GitHub Desktop.
Save WolfangAukang/b45714514cac21d87e6b4dc8b8471eb8 to your computer and use it in GitHub Desktop.
Postfix setup for Amazon SES on NixOS
{ modulesPath, pkgs, ... }: {
# AWS Defaults
imports = [ "${modulesPath}/virtualisation/amazon-image.nix" ];
ec2.hvm = true;
# Server
networking.hostName = "nixos-testing";
boot.cleanTmpDir = true;
# Applications
environment.systemPackages = with pkgs; [
mailutils
];
# Mail
services.postfix = {
enable = true;
# Using password and tls setup with postmap
config = {
smtp_sasl_auth_enable = "yes";
smtp_sasl_security_options = "noanonymous";
smtp_sasl_password_maps = "hash:/etc/postfix/saslpasswd";
smtp_always_send_ehlo = "yes";
smtp_use_tls = "yes";
smtp_tls_security_level = "encrypt";
smtp_tls_note_starttls_offer = "yes";
smtp_tls_policy_maps = "hash:/etc/postfix/tls_policy";
};
relayHost = "email-smtp.us-east-1.amazonaws.com";
relayPort = 587;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment