nixos/consul: use lib.getExe
where possible
which allows the use of custom packages, that may not have binaries called `consul` or `consul-alerts` in their `/bin/*` (though arguably pretty unlikely to be ever used)
This commit is contained in:
parent
9c1f292155
commit
6ad64af778
1 changed files with 3 additions and 3 deletions
|
@ -199,7 +199,7 @@ in
|
||||||
(filterAttrs (n: _: hasPrefix "consul.d/" n) config.environment.etc);
|
(filterAttrs (n: _: hasPrefix "consul.d/" n) config.environment.etc);
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "@${cfg.package}/bin/consul consul agent -config-dir /etc/consul.d"
|
ExecStart = "@${lib.getExe cfg.package} consul agent -config-dir /etc/consul.d"
|
||||||
+ concatMapStrings (n: " -config-file ${n}") configFiles;
|
+ concatMapStrings (n: " -config-file ${n}") configFiles;
|
||||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||||
PermissionsStartOnly = true;
|
PermissionsStartOnly = true;
|
||||||
|
@ -207,7 +207,7 @@ in
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
TimeoutStartSec = "infinity";
|
TimeoutStartSec = "infinity";
|
||||||
} // (optionalAttrs (cfg.leaveOnStop) {
|
} // (optionalAttrs (cfg.leaveOnStop) {
|
||||||
ExecStop = "${cfg.package}/bin/consul leave";
|
ExecStop = "${lib.getExe cfg.package} leave";
|
||||||
});
|
});
|
||||||
|
|
||||||
path = with pkgs; [ iproute2 gawk cfg.package ];
|
path = with pkgs; [ iproute2 gawk cfg.package ];
|
||||||
|
@ -269,7 +269,7 @@ in
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
${cfg.alerts.package}/bin/consul-alerts start \
|
${lib.getExe cfg.alerts.package} start \
|
||||||
--alert-addr=${cfg.alerts.listenAddr} \
|
--alert-addr=${cfg.alerts.listenAddr} \
|
||||||
--consul-addr=${cfg.alerts.consulAddr} \
|
--consul-addr=${cfg.alerts.consulAddr} \
|
||||||
${optionalString cfg.alerts.watchChecks "--watch-checks"} \
|
${optionalString cfg.alerts.watchChecks "--watch-checks"} \
|
||||||
|
|
Loading…
Reference in a new issue