mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
0a37316d6c
This commit replaces a lot of usages of `mkOption` with the package type, to be `mkPackageOption`, in order to reduce the amount of code.
49 lines
1.2 KiB
Nix
49 lines
1.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.arbtt;
|
|
in {
|
|
options = {
|
|
services.arbtt = {
|
|
enable = mkEnableOption (lib.mdDoc "Arbtt statistics capture service");
|
|
|
|
package = mkPackageOption pkgs [ "haskellPackages" "arbtt" ] { };
|
|
|
|
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";
|
|
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 ];
|
|
}
|