at 24.11-pre 1.2 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.services.arbtt; 7in { 8 options = { 9 services.arbtt = { 10 enable = mkEnableOption "Arbtt statistics capture service"; 11 12 package = mkPackageOption pkgs [ "haskellPackages" "arbtt" ] { }; 13 14 logFile = mkOption { 15 type = types.str; 16 default = "%h/.arbtt/capture.log"; 17 example = "/home/username/.arbtt-capture.log"; 18 description = '' 19 The log file for captured samples. 20 ''; 21 }; 22 23 sampleRate = mkOption { 24 type = types.int; 25 default = 60; 26 example = 120; 27 description = '' 28 The sampling interval in seconds. 29 ''; 30 }; 31 }; 32 }; 33 34 config = mkIf cfg.enable { 35 systemd.user.services.arbtt = { 36 description = "arbtt statistics capture service"; 37 wantedBy = [ "graphical-session.target" ]; 38 partOf = [ "graphical-session.target" ]; 39 40 serviceConfig = { 41 Type = "simple"; 42 ExecStart = "${cfg.package}/bin/arbtt-capture --logfile=${cfg.logFile} --sample-rate=${toString cfg.sampleRate}"; 43 Restart = "always"; 44 }; 45 }; 46 }; 47 48 meta.maintainers = [ ]; 49}