diff --git a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
index 83f3c4a03bf..04e1529148e 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
@@ -90,6 +90,13 @@
services.expressvpn.
+
+
+ Grafana
+ Tempo, a distributed tracing store. Available as
+ services.tempo.
+
+
diff --git a/nixos/doc/manual/release-notes/rl-2211.section.md b/nixos/doc/manual/release-notes/rl-2211.section.md
index 2c5cc7c633c..a546d4cd9f3 100644
--- a/nixos/doc/manual/release-notes/rl-2211.section.md
+++ b/nixos/doc/manual/release-notes/rl-2211.section.md
@@ -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).
+- [Grafana Tempo](https://www.grafana.com/oss/tempo/), a distributed tracing store. Available as [services.tempo](#opt-services.tempo.enable).
+
## Backward Incompatibilities {#sec-release-22.11-incompatibilities}
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 2062b833547..2bc1dff6730 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -1027,6 +1027,7 @@
./services/torrent/peerflix.nix
./services/torrent/rtorrent.nix
./services/torrent/transmission.nix
+ ./services/tracing/tempo.nix
./services/ttys/getty.nix
./services/ttys/gpm.nix
./services/ttys/kmscon.nix
diff --git a/nixos/modules/services/tracing/tempo.nix b/nixos/modules/services/tracing/tempo.nix
new file mode 100644
index 00000000000..15491a51c8e
--- /dev/null
+++ b/nixos/modules/services/tracing/tempo.nix
@@ -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";
+ };
+ };
+ };
+}