mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
81 lines
2.0 KiB
Nix
81 lines
2.0 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
inherit (lib) mkEnableOption mkIf mkOption types;
|
|
|
|
cfg = config.services.tempo;
|
|
|
|
settingsFormat = pkgs.formats.yaml {};
|
|
in {
|
|
options.services.tempo = {
|
|
enable = mkEnableOption "Grafana Tempo";
|
|
|
|
settings = mkOption {
|
|
type = settingsFormat.type;
|
|
default = {};
|
|
description = ''
|
|
Specify the configuration for Tempo in Nix.
|
|
|
|
See https://grafana.com/docs/tempo/latest/configuration/ for available options.
|
|
'';
|
|
};
|
|
|
|
configFile = mkOption {
|
|
type = types.nullOr types.path;
|
|
default = null;
|
|
description = ''
|
|
Specify a path to a configuration file that Tempo should use.
|
|
'';
|
|
};
|
|
|
|
extraFlags = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [];
|
|
example = lib.literalExpression
|
|
''
|
|
[ "-config.expand-env=true" ]
|
|
'';
|
|
description = ''
|
|
Additional flags to pass to the `ExecStart=` in `tempo.service`.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
# for tempo-cli and friends
|
|
environment.systemPackages = [ pkgs.tempo ];
|
|
|
|
assertions = [{
|
|
assertion = (
|
|
(cfg.settings == {}) != (cfg.configFile == null)
|
|
);
|
|
message = ''
|
|
Please specify a configuration for Tempo with either
|
|
'services.tempo.settings' or
|
|
'services.tempo.configFile'.
|
|
'';
|
|
}];
|
|
|
|
systemd.services.tempo = {
|
|
description = "Grafana Tempo Service Daemon";
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = let
|
|
conf = if cfg.configFile == null
|
|
then settingsFormat.generate "config.yaml" cfg.settings
|
|
else cfg.configFile;
|
|
in
|
|
{
|
|
ExecStart = "${pkgs.tempo}/bin/tempo --config.file=${conf} ${lib.escapeShellArgs cfg.extraFlags}";
|
|
DynamicUser = true;
|
|
Restart = "always";
|
|
ProtectSystem = "full";
|
|
DevicePolicy = "closed";
|
|
NoNewPrivileges = true;
|
|
WorkingDirectory = "/var/lib/tempo";
|
|
StateDirectory = "tempo";
|
|
};
|
|
};
|
|
};
|
|
}
|