nixos: add module for tempo
It's very barebones but should be OK for now.
This commit is contained in:
parent
c29a489272
commit
03dd01dd2f
|
@ -90,6 +90,13 @@
|
||||||
<link linkend="opt-services.expressvpn.enable">services.expressvpn</link>.
|
<link linkend="opt-services.expressvpn.enable">services.expressvpn</link>.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
<link xlink:href="https://www.grafana.com/oss/tempo/">Grafana
|
||||||
|
Tempo</link>, a distributed tracing store. Available as
|
||||||
|
<link linkend="opt-services.tempo.enable">services.tempo</link>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
<section xml:id="sec-release-22.11-incompatibilities">
|
<section xml:id="sec-release-22.11-incompatibilities">
|
||||||
|
|
|
@ -35,6 +35,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||||
|
|
||||||
- [expressvpn](https://www.expressvpn.com), the CLI client for ExpressVPN. Available as [services.expressvpn](#opt-services.expressvpn.enable).
|
- [expressvpn](https://www.expressvpn.com), the CLI client for ExpressVPN. Available as [services.expressvpn](#opt-services.expressvpn.enable).
|
||||||
|
|
||||||
|
- [Grafana Tempo](https://www.grafana.com/oss/tempo/), a distributed tracing store. Available as [services.tempo](#opt-services.tempo.enable).
|
||||||
|
|
||||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||||
|
|
||||||
## Backward Incompatibilities {#sec-release-22.11-incompatibilities}
|
## Backward Incompatibilities {#sec-release-22.11-incompatibilities}
|
||||||
|
|
|
@ -1027,6 +1027,7 @@
|
||||||
./services/torrent/peerflix.nix
|
./services/torrent/peerflix.nix
|
||||||
./services/torrent/rtorrent.nix
|
./services/torrent/rtorrent.nix
|
||||||
./services/torrent/transmission.nix
|
./services/torrent/transmission.nix
|
||||||
|
./services/tracing/tempo.nix
|
||||||
./services/ttys/getty.nix
|
./services/ttys/getty.nix
|
||||||
./services/ttys/gpm.nix
|
./services/ttys/gpm.nix
|
||||||
./services/ttys/kmscon.nix
|
./services/ttys/kmscon.nix
|
||||||
|
|
68
nixos/modules/services/tracing/tempo.nix
Normal file
68
nixos/modules/services/tracing/tempo.nix
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
{ 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.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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}";
|
||||||
|
DynamicUser = true;
|
||||||
|
Restart = "always";
|
||||||
|
ProtectSystem = "full";
|
||||||
|
DevicePolicy = "closed";
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
WorkingDirectory = "/var/lib/tempo";
|
||||||
|
StateDirectory = "tempo";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue