many improvements

This commit is contained in:
2025-07-17 18:10:37 +02:00
parent 0a731ef17f
commit 82e26ee498
58 changed files with 1970 additions and 1005 deletions

View File

@@ -5,25 +5,53 @@
...
}:
{
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_SCALING_GOVERNOR_ON_AC = "performance";
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 = 50;
options.nix-config = {
power = {
batteryThresholds = lib.mkOption {
type = lib.types.listOf lib.types.int;
default = [ 60 80 ];
description = "Battery charge thresholds for power management.";
};
};
};
config = {
services.tlp = {
enable = true;
settings = {
# processor chooses frequencies itself
CPU_DRIVER_OPMODE_ON_AC = "active";
CPU_DRIVER_OPMODE_ON_BAT = "active";
# governor dictates global behavior of the CPU
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_SCALING_GOVERNOR_ON_AC = "performance";
# energy performance policy (EPP) sets the energy/performance balance
CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_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 = 50;
# enable battery charge thresholds on the default battery
STOP_CHARGE_THRESH_BAT0 = 1;
# services.superfreq = {
# STOP_CHARGE_THRESH_BAT0 = 80;
# CPU_BOOST_ON_AC = 1;
# CPU_BOOST_ON_BAT = 0;
# CPU_HWP_DYN_BOOST_ON_AC = 1;
# CPU_HWP_DYN_BOOST_ON_BAT = 0;
};
};
# services.watt = {
# enable = true;
# settings = {
# charger = {
@@ -32,6 +60,15 @@
# epp = "performance";
# epb = "balance_performance";
# platform_profile = "performance";
# enable_auto_turbo = true;
# # Custom thresholds for auto turbo management
# turbo_auto_settings = {
# load_threshold_high = 70.0;
# load_threshold_low = 30.0;
# temp_threshold_high = 75.0;
# initial_turbo_state = false; # whether turbo should be initially enabled (false = disabled)
# };
# };
# battery = {
@@ -40,8 +77,15 @@
# epp = "power";
# epb = "balance_power";
# platform_profile = "low-power";
# min_freq_mhz = 800;
# max_freq_mhz = 2500;
# enable_auto_turbo = true;
# # Custom thresholds for auto turbo management
# turbo_auto_settings = {
# load_threshold_high = 80.0;
# load_threshold_low = 40.0;
# temp_threshold_high = 65.0;
# initial_turbo_state = false; # whether turbo should be initially enabled (false = disabled)
# };
# };
@@ -51,18 +95,21 @@
# min_poll_interval_sec = 1;
# max_poll_interval_sec = 30;
# throttle_on_battery = true;
# stats_file_path = "/var/run/watt-stats";
# };
# battery_charge_thresholds = [50 90];
# # battery_charge_thresholds = [50 90];
# };
# # logind.lidSwitchExternalPower = "ignore"; # prevent lid switch from triggering a suspend
# };
systemd.sleep.extraConfig = ''
AllowSuspend=yes
AllowHibernation=yes
AllowHybridSleep=yes
AllowSuspendThenHibernate=yes
'';
systemd.sleep.extraConfig = ''
AllowSuspend=yes
AllowHibernation=yes
AllowHybridSleep=yes
AllowSuspendThenHibernate=yes
'';
};
}