From cd9c62afca390a4b9390e526a495736d183ca6e1 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 21 Sep 2024 21:09:43 +0200 Subject: [PATCH] nixos/graphite: add systemd slice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bjørn Forsman --- nixos/modules/services/monitoring/graphite.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index cb259013c670..7987f34f1278 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -273,6 +273,7 @@ in { after = [ "network.target" ]; environment = carbonEnv; serviceConfig = { + Slice = "system-graphite.slice"; RuntimeDirectory = name; ExecStart = "${pkgs.python3Packages.twisted}/bin/twistd ${carbonOpts name}"; User = "graphite"; @@ -295,6 +296,7 @@ in { after = [ "network.target" ]; environment = carbonEnv; serviceConfig = { + Slice = "system-graphite.slice"; RuntimeDirectory = name; ExecStart = "${pkgs.python3Packages.twisted}/bin/twistd ${carbonOpts name}"; User = "graphite"; @@ -311,6 +313,7 @@ in { after = [ "network.target" ]; environment = carbonEnv; serviceConfig = { + Slice = "system-graphite.slice"; RuntimeDirectory = name; ExecStart = "${pkgs.python3Packages.twisted}/bin/twistd ${carbonOpts name}"; User = "graphite"; @@ -360,6 +363,7 @@ in { User = "graphite"; Group = "graphite"; PermissionsStartOnly = true; + Slice = "system-graphite.slice"; }; preStart = '' if ! test -e ${dataDir}/db-created; then @@ -397,6 +401,7 @@ in { WorkingDirectory = dataDir; User = "graphite"; Group = "graphite"; + Slice = "system-graphite.slice"; }; preStart = '' if ! test -e ${dataDir}/db-created; then @@ -413,6 +418,11 @@ in { cfg.carbon.enableCache || cfg.carbon.enableAggregator || cfg.carbon.enableRelay || cfg.web.enable || cfg.seyren.enable ) { + systemd.slices.system-graphite = { + description = "Graphite Graphing System Slice"; + documentation = [ "https://graphite.readthedocs.io/en/latest/overview.html" ]; + }; + users.users.graphite = { uid = config.ids.uids.graphite; group = "graphite";