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