git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/prometheus/alertmanager: use ExecStart instead of script

This results in a simpler service unit which doesn't first have to start a shell: > cat /nix/store/s95nsr8zbkblklanqpkiap49mkwbaq45-unit-alertmanager.service/alertmanager.service ... ExecStart=/nix/store/4g784lwcy7kp69hg0z2hfwkhjp2914lr-alertmanager-0.16.2-bin/bin/alertmanager \ --config.file /nix/store/p2c7fyi2jkkwq04z2flk84q4wyj2ggry-checked-config \ --web.listen-address [::1]:9093 \ --log.level warn ...

commit739bdff4a4b77ad662697364af7d316c1e4a7c2d authorBas van Dijk <v.dijk.bas@gmail.com> dateWed 10 Apr 2019, 15:03 (8 years ago) parent18925d0
1 file changed+3−5
nixos/modules/services/monitoring/prometheus/alertmanager.nix+3−5
nixos/modules/services/monitoring/prometheus/alertmanager.nix+3−5
@@ -151,17 +151,15 @@ in {
151151 systemd.services.alertmanager = {
152152 wantedBy = [ "multi-user.target" ];
153153 after = [ "network.target" ];
154− script = ''
155− ${cfg.package}/bin/alertmanager \
156− ${concatStringsSep " \\\n " cmdlineArgs}
157− '';
158−
159154 serviceConfig = {
160155 User = cfg.user;
161156 Group = cfg.group;
162157 Restart = "always";
163158 PrivateTmp = true;
164159 WorkingDirectory = "/tmp";
160+ ExecStart = "${cfg.package}/bin/alertmanager" +
161+ optionalString (length cmdlineArgs != 0) (" \\\n " +
162+ concatStringsSep " \\\n " cmdlineArgs);
165163 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
166164 };
167165 };