feat: Add better power management for the laptops
All checks were successful
CI / Format Check (push) Successful in 3s
CI / Flake Check (push) Successful in 1m46s
CI / Evaluate Key Configurations (nix-builder) (push) Successful in 13s
CI / Evaluate Key Configurations (nix-desktop1) (push) Successful in 9s
CI / Evaluate Key Configurations (nix-laptop1) (push) Successful in 9s
CI / Evaluate Artifacts (installer-iso-nix-laptop1) (push) Successful in 20s
CI / Evaluate Artifacts (lxc-nix-builder) (push) Successful in 13s
CI / Build and Publish Documentation (push) Successful in 10s

This commit is contained in:
UGA Innovation Factory
2026-02-10 11:59:09 -05:00
parent 6f7e95b9f9
commit 0a07d1a809
2 changed files with 53 additions and 8 deletions

View File

@@ -56,9 +56,9 @@ in
LC_TIME = "en_US.UTF-8";
};
systemd.sleep.extraConfig = ''
systemd.sleep.extraConfig = lib.mkDefault ''
SuspendState=freeze
HibernateDelaySec=2h
HibernateDelaySec=30m
'';
};
}

View File

@@ -58,6 +58,7 @@ in
"i915.enable_psr=0" # Disable Panel Self Refresh (stability)
"i915.enable_dc=0" # Disable display power saving
"i915.enable_fbc=0" # Disable framebuffer compression
"mem_sleep_default=deep" # Use deep sleep (S3) by default
];
# ========== Hardware Configuration ==========
@@ -67,15 +68,59 @@ in
# ========== Filesystem Configuration ==========
athenix.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
athenix.host.filesystem.swapSize = lib.mkDefault "34G"; # Larger swap for hibernation
boot.resumeDevice = "/dev/nvme0n1p2"; # Resume from swap partition
athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ];
# ========== Power Management ==========
services.upower.enable = lib.mkDefault true;
services.logind.settings = {
Login = {
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "suspend";
HandleLidSwitchDocked = "ignore";
systemd.sleep.extraConfig = ''
SuspendState=mem
HibernateDelaySec=30m
'';
powerManagement.enable = lib.mkDefault true;
powerManagement.powertop.enable = lib.mkDefault true;
services = {
upower.enable = lib.mkDefault true;
logind.settings = {
Login = {
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "suspend";
HandleLidSwitchDocked = "ignore";
PowerKey = "hibernate";
PowerKeyLongPress = "poweroff";
};
};
power-profiles-daemon.enable = false;
tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 20;
#Optional helps save long term battery health
START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge
STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging
};
};
auto-cpufreq = {
enable = lib.mkDefault true;
settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
};
};