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