blob: db16bced3a5ed97f479162a33342f57beaa6ddca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
{ 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;
services.postfix.recipientDelimiter = "+";
services.postfix.config.home_mailbox = "mail/INBOX/";
services.postfix.canonical = ''
qyliss hi@alyssa.is
'';
services.postfix.virtual = ''
hi@alyssa.is qyliss
'';
# 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.sender_dependent_relayhost_maps = "hash:/etc/postfix/sender_dependent_relayhost";
services.postfix.mapFiles.sender_dependent_relayhost = pkgs.writeText "sender_dependent_relayhost" ''
@unikie.com [smtp.gmail.com]:465
'';
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;
systemd.services.postfix-setup.unitConfig.ConditionPathExists = "/var/lib/postfix/sasl_passwd";
systemd.services.postfix.unitConfig.ConditionPathExists = "/var/lib/postfix/sasl_passwd";
}
|