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