nixos/opensmtpd: refactor to use tmpfiles to set up spool directories
This commit is contained in:
parent
c62815d35f
commit
e349b6e0fe
|
@ -101,6 +101,12 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/spool/smtpd 711 root - - -"
|
||||
"d /var/spool/smtpd/offline 770 root smtpq - -"
|
||||
"d /var/spool/smtpd/purge 700 smtpq root - -"
|
||||
];
|
||||
|
||||
systemd.services.opensmtpd = let
|
||||
procEnv = pkgs.buildEnv {
|
||||
name = "opensmtpd-procs";
|
||||
|
@ -110,18 +116,6 @@ in {
|
|||
in {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
preStart = ''
|
||||
mkdir -p /var/spool/smtpd
|
||||
chmod 711 /var/spool/smtpd
|
||||
|
||||
mkdir -p /var/spool/smtpd/offline
|
||||
chown root.smtpq /var/spool/smtpd/offline
|
||||
chmod 770 /var/spool/smtpd/offline
|
||||
|
||||
mkdir -p /var/spool/smtpd/purge
|
||||
chown smtpq.root /var/spool/smtpd/purge
|
||||
chmod 700 /var/spool/smtpd/purge
|
||||
'';
|
||||
serviceConfig.ExecStart = "${cfg.package}/sbin/smtpd -d -f ${conf} ${args}";
|
||||
environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd";
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue