nixos/grafana-agent: add extraFlags
option (#228883)
This commit is contained in:
parent
360ab51ee7
commit
549bee9851
|
@ -13,12 +13,7 @@ in
|
||||||
options.services.grafana-agent = {
|
options.services.grafana-agent = {
|
||||||
enable = mkEnableOption (lib.mdDoc "grafana-agent");
|
enable = mkEnableOption (lib.mdDoc "grafana-agent");
|
||||||
|
|
||||||
package = mkOption {
|
package = mkPackageOptionMD pkgs "grafana-agent" { };
|
||||||
type = types.package;
|
|
||||||
default = pkgs.grafana-agent;
|
|
||||||
defaultText = lib.literalExpression "pkgs.grafana-agent";
|
|
||||||
description = lib.mdDoc "The grafana-agent package to use.";
|
|
||||||
};
|
|
||||||
|
|
||||||
credentials = mkOption {
|
credentials = mkOption {
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
|
@ -37,11 +32,22 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraFlags = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
default = [ ];
|
||||||
|
example = [ "-enable-features=integrations-next" "-disable-reporting" ];
|
||||||
|
description = lib.mdDoc ''
|
||||||
|
Extra command-line flags passed to {command}`grafana-agent`.
|
||||||
|
|
||||||
|
See <https://grafana.com/docs/agent/latest/static/configuration/flags/>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Configuration for `grafana-agent`.
|
Configuration for {command}`grafana-agent`.
|
||||||
|
|
||||||
See https://grafana.com/docs/agent/latest/configuration/
|
See <https://grafana.com/docs/agent/latest/configuration/>
|
||||||
'';
|
'';
|
||||||
|
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
|
@ -140,7 +146,7 @@ in
|
||||||
# We can't use Environment=HOSTNAME=%H, as it doesn't include the domain part.
|
# We can't use Environment=HOSTNAME=%H, as it doesn't include the domain part.
|
||||||
export HOSTNAME=$(< /proc/sys/kernel/hostname)
|
export HOSTNAME=$(< /proc/sys/kernel/hostname)
|
||||||
|
|
||||||
exec ${lib.getExe cfg.package} -config.expand-env -config.file ${configFile}
|
exec ${lib.getExe cfg.package} -config.expand-env -config.file ${configFile} ${escapeShellArgs cfg.extraFlags}
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
|
|
Loading…
Reference in a new issue