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