nixos/prometheus: use ExecStart instead of a shell script

This uses fewer lines of code and one less process.
This commit is contained in:
Bas van Dijk 2019-04-08 13:44:22 +02:00 committed by Jean-Baptiste Giraudeau
parent 0333d877c2
commit a59c92903e
No known key found for this signature in database
GPG key ID: E96EF57FD501B961

View file

@ -662,12 +662,10 @@ in {
systemd.services.prometheus = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
script = ''
#!/bin/sh
exec ${cfg.package}/bin/prometheus \
${concatStringsSep " \\\n " cmdlineArgs}
'';
serviceConfig = {
ExecStart = "${cfg.package}/bin/prometheus" +
optionalString (length cmdlineArgs != 0) (" \\\n " +
concatStringsSep " \\\n " cmdlineArgs);
User = promUser;
Restart = "always";
WorkingDirectory = /var/lib/prometheus;
@ -679,12 +677,10 @@ in {
systemd.services.prometheus2 = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
script = ''
#!/bin/sh
exec ${cfg2.package}/bin/prometheus \
${concatStringsSep " \\\n " cmdlineArgs2}
'';
serviceConfig = {
ExecStart = "${cfg2.package}/bin/prometheus" +
optionalString (length cmdlineArgs2 != 0) (" \\\n " +
concatStringsSep " \\\n " cmdlineArgs2);
User = promUser;
Restart = "always";
WorkingDirectory = /var/lib/prometheus2;