nixos/vault-agent: fix ExecStart generation when a vault package is set

Without this fix, if `config.services.vault.package` is set to e.g.
`vault-bin` (instead of the `vault` default), then `ExecStart` gets
improperly generated without the `agent` positional argument because
`vault-bin` did not match `vault`, and the command for the `consul`
flavor gets generated instead.

To fix this, we can look at the `flavor` argument instead of the package
name.
This commit is contained in:
Louis Opter 2025-02-22 18:44:24 +00:00 committed by GitHub
parent c414ff7314
commit 324404fe2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -125,7 +125,7 @@ let
Group = instance.group;
RuntimeDirectory = flavour;
ExecStart = "${lib.getExe instance.package} ${
lib.optionalString ((lib.getName instance.package) == "vault") "agent"
lib.optionalString (flavour == "vault-agent") "agent"
} -config ${configFile}";
ExecReload = "${pkgs.coreutils}/bin/kill -SIGHUP $MAINPID";
KillSignal = "SIGINT";