diff options
Diffstat (limited to 'nixpkgs/nixos/modules/tasks/powertop.nix')
-rw-r--r-- | nixpkgs/nixos/modules/tasks/powertop.nix | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/tasks/powertop.nix b/nixpkgs/nixos/modules/tasks/powertop.nix new file mode 100644 index 00000000000..e8064f9fa80 --- /dev/null +++ b/nixpkgs/nixos/modules/tasks/powertop.nix @@ -0,0 +1,29 @@ +{ 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" ]; + after = [ "multi-user.target" ]; + description = "Powertop tunings"; + path = [ pkgs.kmod ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = "yes"; + ExecStart = "${pkgs.powertop}/bin/powertop --auto-tune"; + }; + }; + }; + }; +} |