diff --git a/modules/hardware/misc/cpu-thermal.nix b/modules/hardware/misc/cpu-freq.nix similarity index 85% rename from modules/hardware/misc/cpu-thermal.nix rename to modules/hardware/misc/cpu-freq.nix index 58d8180..2b6476a 100644 --- a/modules/hardware/misc/cpu-thermal.nix +++ b/modules/hardware/misc/cpu-freq.nix @@ -1,7 +1,5 @@ { ... }: { services = { - thermald.enable = false; - throttled.enable = true; power-profiles-daemon.enable = false; # replacement for tlp and auto-cpufreq due to bugs tlp = { enable = false; # buggy and inconsistent with frequency scaling @@ -55,29 +53,20 @@ charger = { governor = "performance"; energy_performance_preference = "performance"; - turbo = "auto"; + turbo = "always"; platform_profile = "performance"; scaling_min_freq = 800000; scaling_max_freq = 3600000; }; battery = { governor = "powersave"; - energy_performance_preference = "power"; + energy_performance_preference = "balance-power"; platform_profile = "low-power"; turbo = "never"; scaling_min_freq = 400000; - scaling_max_freq = 1000000; + scaling_max_freq = 1700000; }; }; }; - thinkfan = { - enable = true; - levels = [ - [ "level auto" 0 55 ] - [ 3 55 65 ] - [ 7 65 75 ] - [ "level full-speed" 75 100 ] - ]; - }; }; } diff --git a/modules/hardware/thinkpad.nix b/modules/hardware/thinkpad.nix index d79881c..03df0fa 100644 --- a/modules/hardware/thinkpad.nix +++ b/modules/hardware/thinkpad.nix @@ -2,7 +2,7 @@ imports = [ ./misc/battery-power.nix ./misc/power-button.nix - ./misc/cpu-thermal.nix + ./misc/cpu-freq.nix ./misc/tzupdate.nix ./core/hibernation.nix ./core/firmware.nix @@ -14,10 +14,64 @@ kernelPackages = pkgs.linuxPackages; kernel.sysctl."vm.laptop_mode" = 5; initrd.availableKernelModules = [ "thinkpad_acpi" ]; + kernelParams = [ + "i915.enable_psr=1" + "pcie_aspm=force" + "nmi_watchdog=0" + # ^^ potential instability, but improves battery life + + "loglevel=3" + "i915.enable_guc=3" + "i915.enable_fbc=1" + "msr.allow-writes=on" + "nvme_core.default_ps_max_latency_us=0" + ]; }; hardware.bluetooth = { enable = true; powerOnBoot = false; }; - services.hardware.bolt.enable = true; + services = { + throttled = { + enable = true; + extraConfig = '' + [GENERAL] + Enabled: True + Update_Rate_s: 30 + + [BATTERY] + Update_Rate_s: 30 + PL1_Tdp_W: 12 + PL1_Duration_s: 28 + PL2_Tdp_W: 20 + PL2_Duration_s: 0.002 + Trip_Temp_C: 85 + + [AC] + Update_Rate_s: 5 + PL1_Tdp_W: 25 + PL1_Duration_s: 28 + PL2_Tdp_W: 35 + PL2_Duration_s: 0.002 + Trip_Temp_C: 90 + + [UNDERVOLT] + CORE: -100 + GPU: -80 + CACHE: -100 + UNCORE: -80 + ANALOGIO: 0 + ''; + }; + thinkfan = { + enable = true; + levels = [ + [ "level auto" 0 55 ] + [ 3 55 65 ] + [ 7 65 75 ] + [ "level full-speed" 75 100 ] + ]; + }; + hardware.bolt.enable = true; + }; } diff --git a/modules/home/desktop.nix b/modules/home/desktop.nix index 8240230..b586d3c 100644 --- a/modules/home/desktop.nix +++ b/modules/home/desktop.nix @@ -25,6 +25,7 @@ nwg-displays lxqt.pcmanfm-qt hyprshot wl-clipboard cliphist + hyprshutdown ]; }; } diff --git a/modules/home/rice/hyprland.nix b/modules/home/rice/hyprland.nix index 6b151f7..440d066 100644 --- a/modules/home/rice/hyprland.nix +++ b/modules/home/rice/hyprland.nix @@ -141,6 +141,7 @@ "no_anim on, match:namespace selection" # hyprshot overlay "animation fade, match:namespace swww-daemon" "animation fade, match:namespace logout_dialog" + "animation fade, match:namespace hyprshutdown" "above_lock 1, match:namespace waybar" "above_lock 2, match:namespace notifications" "above_lock 2, match:namespace selection" diff --git a/modules/home/rice/wlogout.nix b/modules/home/rice/wlogout.nix index 56da15a..da57d5a 100644 --- a/modules/home/rice/wlogout.nix +++ b/modules/home/rice/wlogout.nix @@ -4,13 +4,13 @@ layout = [ { label = "shutdown"; - action = "systemctl poweroff"; + action = "hyprshutdown -t 'Shutting down...' --post-cmd 'systemctl poweroff'"; text = "(S)hutdown"; keybind = "s"; } { label = "reboot"; - action = "systemctl reboot"; + action = "hyprshutdown -t 'Rebooting...' --post-cmd 'systemctl reboot'"; text = "(R)eboot"; keybind = "r"; } @@ -28,7 +28,7 @@ } { label = "logout"; - action = "uwsm stop"; + action = "hyprshutdown -t 'Logging Out...' --post-cmd 'uwsm stop'"; text = "L(o)gout"; keybind = "o"; } diff --git a/modules/system/misc/utilities.nix b/modules/system/misc/utilities.nix index 1d18023..f6eca54 100644 --- a/modules/system/misc/utilities.nix +++ b/modules/system/misc/utilities.nix @@ -46,7 +46,10 @@ sysstat netcat p7zip + throttled + tlp stress + stress-ng wakeonlan coreutils-full traceroute