2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.arbtt;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.arbtt = {
|
2022-11-21 17:40:18 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "Arbtt statistics capture service");
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs [ "haskellPackages" "arbtt" ] { };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
logFile = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "%h/.arbtt/capture.log";
|
|
|
|
example = "/home/username/.arbtt-capture.log";
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-04-24 23:36:52 +00:00
|
|
|
The log file for captured samples.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
sampleRate = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 60;
|
|
|
|
example = 120;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-04-24 23:36:52 +00:00
|
|
|
The sampling interval in seconds.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = 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 = [ maintainers.michaelpj ];
|
|
|
|
}
|