{ config, lib, pkgs, ... }: { 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; # 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 = { # governor = "performance"; # turbo = "auto"; # 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 = { # governor = "powersave"; # turbo = "auto"; # epp = "power"; # epb = "balance_power"; # platform_profile = "low-power"; # 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) # }; # }; # daemon = { # poll_interval_sec = 10; # adaptive_interval = true; # 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]; # }; # # logind.lidSwitchExternalPower = "ignore"; # prevent lid switch from triggering a suspend # }; systemd.sleep.extraConfig = '' AllowSuspend=yes AllowHibernation=yes AllowHybridSleep=yes AllowSuspendThenHibernate=yes ''; }; }