Add auto-cpufreq for power management.

This commit is contained in:
CronyAkatsuki 2025-01-30 12:23:59 +01:00
parent 11d7923b72
commit 38494003cc
3 changed files with 47 additions and 0 deletions

21
flake.lock generated
View File

@ -1,5 +1,25 @@
{
"nodes": {
"auto-cpufreq": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1737497253,
"narHash": "sha256-sOLwi/3oQiNWA2I3WiGneK988YdKVHbH1P5lEjxypIg=",
"owner": "AdnanHodzic",
"repo": "auto-cpufreq",
"rev": "4cee388c1bbea3adc333b597717d5d8d12375705",
"type": "github"
},
"original": {
"owner": "AdnanHodzic",
"repo": "auto-cpufreq",
"type": "github"
}
},
"base16": {
"inputs": {
"fromYaml": "fromYaml"
@ -3231,6 +3251,7 @@
},
"root": {
"inputs": {
"auto-cpufreq": "auto-cpufreq",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nvf": "nvf",

View File

@ -19,12 +19,19 @@
url = "github:notashelf/nvf";
inputs.nixpkgs.follows = "nixpkgs";
};
# auto-cpufreq latest version, for optimizing my laptop's thermal's
auto-cpufreq = {
url = "github:AdnanHodzic/auto-cpufreq";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
home-manager,
auto-cpufreq,
...
} @ inputs: {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
@ -34,6 +41,8 @@
./hosts/nixos/configuration.nix
# Enable stylix
inputs.stylix.nixosModules.stylix
# Load updated auto-cpufreq
auto-cpufreq.nixosModules.default
# Load my modules
./modules/nixos
# Setup home manager for my user

View File

@ -95,6 +95,23 @@
options = ["_netdev" "noauto" "x-systemd.automount" "x-systemd.mount-timeout=10" "timeo=14" "x-systemd.idle-timeout=600"];
};
# Setup auto-cpufreq
programs.auto-cpufreq = {
enable = true;
settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
};
# Allow for wireguard traffic
networking.firewall = {
# if packets are still dropped, they will show up in dmesg