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
|
|
|
|
|
2024-04-13 12:54:15 +00:00
|
|
|
options.powerManagement.powertop.enable = mkEnableOption "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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|