at 24.11-pre 652 B view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.powerManagement.powertop; 7in { 8 ###### interface 9 10 options.powerManagement.powertop.enable = mkEnableOption "powertop auto tuning on startup"; 11 12 ###### implementation 13 14 config = mkIf (cfg.enable) { 15 systemd.services = { 16 powertop = { 17 wantedBy = [ "multi-user.target" ]; 18 after = [ "multi-user.target" ]; 19 description = "Powertop tunings"; 20 path = [ pkgs.kmod ]; 21 serviceConfig = { 22 Type = "oneshot"; 23 RemainAfterExit = "yes"; 24 ExecStart = "${pkgs.powertop}/bin/powertop --auto-tune"; 25 }; 26 }; 27 }; 28 }; 29}