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": {
"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": {
"inputs": {
"nixpkgs": [
@ -355,6 +375,7 @@
},
"root": {
"inputs": {
"auto-cpufreq": "auto-cpufreq",
"home-manager": "home-manager",
"lanzaboote": "lanzaboote",
"lib": "lib",

View file

@ -35,10 +35,17 @@
# NixOS hardware quirks
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 =
inputs@{
auto-cpufreq,
home-manager,
lanzaboote,
lix-module,
@ -58,6 +65,7 @@
# Define shared modules and imports
defaultModules = [
./modules/autoimport.nix
auto-cpufreq.nixosModules.default
lix-module.nixosModules.default
lanzaboote.nixosModules.lanzaboote
nix-flatpak.nixosModules.nix-flatpak

View file

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

View file

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

View file

@ -37,12 +37,18 @@ in
xz.bin
];
};
powerManagement.enable = lib.mkEnableOption "Enables power management, e.g. for laptops.";
};
};
config = {
# Install base 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 = {
# Automatically set the timezone based on location
automatic-timezoned.enable = true;