1
0
Fork 0

System: enable power management via auto-cpufreq

This commit is contained in:
Aires 2024-11-25 17:57:14 -05:00
parent fce3ca936e
commit 5aa6b329c6
5 changed files with 39 additions and 0 deletions

View file

@ -1,5 +1,25 @@
{ {
"nodes": { "nodes": {
"auto-cpufreq": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1730737631,
"narHash": "sha256-YsAImsJDFpkW+z45/rj/vceZ8C48gv9RUpnakpc+q5c=",
"owner": "AdnanHodzic",
"repo": "auto-cpufreq",
"rev": "18a3a93f62f2572bc8ed8e953d09dca4a87da9bc",
"type": "github"
},
"original": {
"owner": "AdnanHodzic",
"repo": "auto-cpufreq",
"type": "github"
}
},
"crane": { "crane": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -355,6 +375,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"auto-cpufreq": "auto-cpufreq",
"home-manager": "home-manager", "home-manager": "home-manager",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"lib": "lib", "lib": "lib",

View file

@ -35,10 +35,17 @@
# NixOS hardware quirks # NixOS hardware quirks
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# Power management via auto-cpufreq
auto-cpufreq = {
url = "github:AdnanHodzic/auto-cpufreq";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
inputs@{ inputs@{
auto-cpufreq,
home-manager, home-manager,
lanzaboote, lanzaboote,
lix-module, lix-module,
@ -58,6 +65,7 @@
# Define shared modules and imports # Define shared modules and imports
defaultModules = [ defaultModules = [
./modules/autoimport.nix ./modules/autoimport.nix
auto-cpufreq.nixosModules.default
lix-module.nixosModules.default lix-module.nixosModules.default
lanzaboote.nixosModules.lanzaboote lanzaboote.nixosModules.lanzaboote
nix-flatpak.nixosModules.nix-flatpak nix-flatpak.nixosModules.nix-flatpak

View file

@ -41,6 +41,8 @@ in
# Enable GPU support. # Enable GPU support.
gpu.intel.enable = true; gpu.intel.enable = true;
powerManagement.enable = true;
# Enable support for primary RAID array (just in case) # Enable support for primary RAID array (just in case)
raid.storage.enable = true; raid.storage.enable = true;

View file

@ -53,6 +53,8 @@ in
# Keep old generations for two weeks. # Keep old generations for two weeks.
retentionPeriod = "14d"; retentionPeriod = "14d";
powerManagement.enable = true;
services = { services = {
# Run daily automatic updates. # Run daily automatic updates.
autoUpgrade = { autoUpgrade = {

View file

@ -37,12 +37,18 @@ in
xz.bin xz.bin
]; ];
}; };
powerManagement.enable = lib.mkEnableOption "Enables power management, e.g. for laptops.";
}; };
}; };
config = { config = {
# Install base packages # Install base packages
environment.systemPackages = cfg.corePackages ++ cfg.packages; environment.systemPackages = cfg.corePackages ++ cfg.packages;
# Configure power management via auto-cpufreq
# https://github.com/AdnanHodzic/auto-cpufreq
programs.auto-cpufreq.enable = cfg.powerManagement.enable;
services = { services = {
# Automatically set the timezone based on location # Automatically set the timezone based on location
automatic-timezoned.enable = true; automatic-timezoned.enable = true;