From 6c48caaea8461f268c9ae3b0517553ac946762a2 Mon Sep 17 00:00:00 2001 From: GarandPLG Date: Sat, 27 Sep 2025 14:58:23 +0200 Subject: [PATCH] Add auto-cpufreq for adaptive CPU frequency scaling --- flake.lock | 21 +++++++++++++++++++++ flake.nix | 7 +++++++ modules/core/auto-cpufreq.nix | 17 +++++++++++++++++ modules/core/default.nix | 1 + 4 files changed, 46 insertions(+) create mode 100644 modules/core/auto-cpufreq.nix diff --git a/flake.lock b/flake.lock index 0575e32..92325c3 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "auto-cpufreq": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1758887019, + "narHash": "sha256-5QDHaIKbmremgFh8Pc9ess59K4HJ5APM8pNgnYzAMno=", + "owner": "AdnanHodzic", + "repo": "auto-cpufreq", + "rev": "52194f4db364347626985fed5372eba2b6109cf4", + "type": "github" + }, + "original": { + "owner": "AdnanHodzic", + "repo": "auto-cpufreq", + "type": "github" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -276,6 +296,7 @@ }, "root": { "inputs": { + "auto-cpufreq": "auto-cpufreq", "firefox-addons": "firefox-addons", "home-manager": "home-manager", "nix-flatpak": "nix-flatpak", diff --git a/flake.nix b/flake.nix index bef7c05..4ccd134 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + auto-cpufreq = { + url = "github:AdnanHodzic/auto-cpufreq"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + firefox-addons = { url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs.nixpkgs.follows = "nixpkgs"; @@ -32,6 +37,7 @@ nixpkgs, home-manager, nix-flatpak, + auto-cpufreq, ... }@inputs: let @@ -59,6 +65,7 @@ modules = [ ./profiles/${profile} nix-flatpak.nixosModules.nix-flatpak + auto-cpufreq.nixosModules.default ]; }; in diff --git a/modules/core/auto-cpufreq.nix b/modules/core/auto-cpufreq.nix new file mode 100644 index 0000000..e7a1d3f --- /dev/null +++ b/modules/core/auto-cpufreq.nix @@ -0,0 +1,17 @@ +{ ... }: +{ + programs.auto-cpufreq = { + enable = true; + settings = { + charger = { + governor = "performance"; + turbo = "auto"; + }; + + battery = { + governor = "powersave"; + turbo = "auto"; + }; + }; + }; +} diff --git a/modules/core/default.nix b/modules/core/default.nix index 7bc0748..ff0f0a5 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -5,6 +5,7 @@ { imports = [ ./packages + ./auto-cpufreq.nix ./boot.nix ./flatpak.nix ./fonts.nix