Laptop: Difference between revisions

imported>Neongreensniper
Added information about a flake that auto-cpufreq provides
Line 50: Line 50:
   };
   };
};
};
</syntaxHighlight>
</syntaxHighlight>Alternatively, if you have [[Flakes]] enabled you can also use the flake directly provided by the auto-cpufreq authors to get a more up-to-date version.  They offer a detailed explanation how to add it to your system on their [https://github.com/AdnanHodzic/auto-cpufreq?tab=readme-ov-file#nixos GitHub page].
 
To summarize: 1) add the flake as an input to your <code>flake.nix</code> file and enable the module:<syntaxhighlight lang="nix">
# flake.nix
 
{
    inputs = {
        # ---Snip---
        auto-cpufreq = {
            url = "github:AdnanHodzic/auto-cpufreq";
            inputs.nixpkgs.follows = "nixpkgs";
        };
        # ---Snip---
    }
 
    outputs = inputs@{nixpkgs, auto-cpufreq, ...} : {
        nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
            specialArgs = { inherit inputs; };
            modules = [
                ./configuration.nix
                auto-cpufreq.nixosModules.default
            ];
        };
    }
}
</syntaxhighlight>2) Then enable it in your <code>configuration.nix</code> file:<syntaxhighlight lang="nix">
# configuration.nix
 
{inputs, pkgs, ...}: {
    # ---Snip---
 
    programs.auto-cpufreq.enable = true;
 
    # optionally, you can configure your auto-cpufreq settings, if you have any
    programs.auto-cpufreq.settings = {
      charger = {
        governor = "performance";
        turbo = "auto";
      };
      battery = {
        governor = "powersave";
        turbo = "auto";
      };
    };
    # ---Snip---
}
</syntaxhighlight>Since v2.0 auto-cpufreq also includes a GUI that lets you temporarily override the CPU frequency governor setting.


==== Powertop ====
==== Powertop ====