nixos/nginx: always run systemctl of the currently running systemd

Also, make the postRun script refer to that systemctl, and not just rely
on $PATH for consistency.
This commit is contained in:
Florian Klink 2020-05-21 10:31:26 +02:00
parent 1955982190
commit a3678ed347

View File

@ -756,9 +756,9 @@ in
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
serviceConfig.TimeoutSec = 60; serviceConfig.TimeoutSec = 60;
script = '' script = ''
if ${pkgs.systemd}/bin/systemctl -q is-active nginx.service ; then if /run/current-system/systemd/bin/systemctl -q is-active nginx.service ; then
${execCommand} -t && \ ${execCommand} -t && \
${pkgs.systemd}/bin/systemctl reload nginx.service /run/current-system/systemd/bin/systemctl reload nginx.service
fi fi
''; '';
serviceConfig.RemainAfterExit = true; serviceConfig.RemainAfterExit = true;
@ -772,7 +772,7 @@ in
webroot = vhostConfig.acmeRoot; webroot = vhostConfig.acmeRoot;
extraDomains = genAttrs vhostConfig.serverAliases (alias: null); extraDomains = genAttrs vhostConfig.serverAliases (alias: null);
postRun = '' postRun = ''
systemctl reload nginx /run/current-system/systemd/bin/systemctl reload nginx
''; '';
}; }) acmeEnabledVhosts; }; }) acmeEnabledVhosts;
in in