diff --git a/cluster/services/ways/host.nix b/cluster/services/ways/host.nix index 90455c3..984d55c 100644 --- a/cluster/services/ways/host.nix +++ b/cluster/services/ways/host.nix @@ -89,11 +89,11 @@ in '') consulServiceWays; in pkgs.writeText "ways-upstreams.ctmpl" (lib.concatStringsSep "\n" (lib.unique upstreams)); destination = "/run/consul-template/nginx-ways-upstreams.conf"; - exec.command = [ - "${config.services.nginx.package}/bin/nginx" - "-s" "reload" - "-g" "pid /run/nginx/nginx.pid;" - ]; + exec.command = lib.singleton (pkgs.writeShellScript "ways-reload" '' + if ${config.systemd.package}/bin/systemctl is-active nginx.service; then + exec ${config.services.nginx.package}/bin/nginx -s reload -g 'pid /run/nginx/nginx.pid;' + fi + ''); } ]; };