mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-19 16:09:19 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
93 lines
2.1 KiB
Nix
93 lines
2.1 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";
|
|
};
|
|
};
|
|
};
|
|
}
|