2017-04-15 12:36:10 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2017-05-16 16:22:44 +00:00
|
|
|
cfg = config.powerManagement.powertop;
|
2017-04-15 12:36:10 +00:00
|
|
|
in {
|
|
|
|
###### interface
|
|
|
|
|
2022-08-28 19:18:44 +00:00
|
|
|
options.powerManagement.powertop.enable = mkEnableOption (lib.mdDoc "powertop auto tuning on startup");
|
2017-04-15 12:36:10 +00:00
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf (cfg.enable) {
|
|
|
|
systemd.services = {
|
|
|
|
powertop = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2020-01-09 11:22:41 +00:00
|
|
|
after = [ "multi-user.target" ];
|
2017-04-15 12:36:10 +00:00
|
|
|
description = "Powertop tunings";
|
2017-10-07 20:45:43 +00:00
|
|
|
path = [ pkgs.kmod ];
|
2017-04-15 12:36:10 +00:00
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = "yes";
|
|
|
|
ExecStart = "${pkgs.powertop}/bin/powertop --auto-tune";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|