From 894babd3da302aa0e62cdfbfd966c7a4a26bf6ad Mon Sep 17 00:00:00 2001 From: jay Date: Mon, 21 Jul 2025 16:15:33 -0400 Subject: [PATCH] Enable auto-cpufreq for battery savings. --- flake.nix | 5 +++++ nodes/hosts/nixwork/configuration.nix | 2 ++ nodes/hosts/nixwork/programs/auto-cpufreq.nix | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 nodes/hosts/nixwork/programs/auto-cpufreq.nix diff --git a/flake.nix b/flake.nix index 01c7ebe..e37e649 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,11 @@ inputs.nixpkgs.follows = "nixpkgs-stable-nixos"; }; + auto-cpufreq-stable-nixos = { + url = "github:AdnanHodzic/auto-cpufreq"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + disko-stable-nixos = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs-stable-nixos"; diff --git a/nodes/hosts/nixwork/configuration.nix b/nodes/hosts/nixwork/configuration.nix index 90e7f15..5f13216 100644 --- a/nodes/hosts/nixwork/configuration.nix +++ b/nodes/hosts/nixwork/configuration.nix @@ -9,6 +9,8 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix inputs.nixos-hardware.nixosModules.framework-16-7040-amd + inputs.auto-cpufreq.nixosModules.default + ./programs/auto-cpufreq.nix ./programs/sof-firmware.nix # Not working yet. ./services/fprintd.nix diff --git a/nodes/hosts/nixwork/programs/auto-cpufreq.nix b/nodes/hosts/nixwork/programs/auto-cpufreq.nix new file mode 100644 index 0000000..79b62d0 --- /dev/null +++ b/nodes/hosts/nixwork/programs/auto-cpufreq.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: { + # List packages installed in system profile. To search, run: + # $ nix search wget + programs.auto-cpufreq = { + enable = true; + settings = { + charger = { + governor = "performance"; + turbo = "auto"; + }; + battery = { + governor = "power-saver"; + turbo = "never"; + }; + }; + }; +} +