summary refs log tree commit diff
path: root/nixos/modules/tasks/powertop.nix
blob: 0ec4974789b4fa80d4b50b19f23e8d38eccde669 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.powerManagement.powertop;
in {
  ###### interface

  options.powerManagement.powertop.enable = mkEnableOption "powertop auto tuning on startup";

  ###### implementation

  config = mkIf (cfg.enable) {
    systemd.services = {
      powertop = {
        wantedBy = [ "multi-user.target" ];
        description = "Powertop tunings";
        serviceConfig = {
          Type = "oneshot";
          RemainAfterExit = "yes";
          ExecStart = "${pkgs.powertop}/bin/powertop --auto-tune";
        };
      };
    };
  };
}