From 10e2d88f6c528e2945306d22b5fc5a53e60ba228 Mon Sep 17 00:00:00 2001 From: Michael Peyton Jones Date: Sun, 1 Jan 2017 16:45:26 +0000 Subject: arbtt service: init --- nixos/modules/services/monitoring/arbtt.nix | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 nixos/modules/services/monitoring/arbtt.nix (limited to 'nixos/modules/services/monitoring/arbtt.nix') diff --git a/nixos/modules/services/monitoring/arbtt.nix b/nixos/modules/services/monitoring/arbtt.nix new file mode 100644 index 00000000000..27d59e367d5 --- /dev/null +++ b/nixos/modules/services/monitoring/arbtt.nix @@ -0,0 +1,63 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.arbtt; +in { + options = { + services.arbtt = { + enable = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + Enable the arbtt statistics capture service. + ''; + }; + + package = mkOption { + type = types.package; + default = pkgs.haskellPackages.arbtt; + defaultText = "pkgs.haskellPackages.arbtt"; + example = literalExample "pkgs.haskellPackages.arbtt"; + description = '' + The package to use for the arbtt binaries. + ''; + }; + + logFile = mkOption { + type = types.str; + default = "%h/.arbtt/capture.log"; + example = "/home/username/.arbtt-capture.log"; + description = '' + The log file for captured samples. + ''; + }; + + sampleRate = mkOption { + type = types.int; + default = 60; + example = 120; + description = '' + The sampling interval in seconds. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + systemd.user.services.arbtt = { + description = "arbtt statistics capture service"; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + Type = "simple"; + ExecStart = "${cfg.package}/bin/arbtt-capture --logfile=${cfg.logFile} --sample-rate=${toString cfg.sampleRate}"; + Restart = "always"; + }; + }; + }; + + meta.maintainers = [ maintainers.michaelpj ]; +} -- cgit 1.4.1