2017-01-01 16:45:26 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.arbtt;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.arbtt = {
|
2022-11-09 21:45:00 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "Arbtt statistics capture service");
|
2017-01-01 16:45:26 +00:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.haskellPackages.arbtt;
|
2021-10-03 16:06:03 +00:00
|
|
|
defaultText = literalExpression "pkgs.haskellPackages.arbtt";
|
2017-01-01 16:45:26 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
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 = lib.mdDoc ''
|
|
|
|
The log file for captured samples.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
sampleRate = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 60;
|
|
|
|
example = 120;
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
The sampling interval in seconds.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.user.services.arbtt = {
|
|
|
|
description = "arbtt statistics capture service";
|
2017-05-25 17:33:13 +00:00
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
partOf = [ "graphical-session.target" ];
|
2017-01-01 16:45:26 +00:00
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
ExecStart = "${cfg.package}/bin/arbtt-capture --logfile=${cfg.logFile} --sample-rate=${toString cfg.sampleRate}";
|
|
|
|
Restart = "always";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = [ maintainers.michaelpj ];
|
|
|
|
}
|