From 293621c19cf320734e5f308d6b93ad77a1deb80f Mon Sep 17 00:00:00 2001 From: wi11-holdsworth <83637728+wi11-holdsworth@users.noreply.github.com> Date: Wed, 6 Aug 2025 21:50:59 +1000 Subject: [PATCH] install tlp on laptop --- hosts/laptop/configuration.nix | 1 + modules/nixos/features/tlp.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 modules/nixos/features/tlp.nix diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 48570d1..eb3d930 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -16,6 +16,7 @@ amd-gpu.enable = true; desktop.enable = true; gnome.enable = true; + tlp.enable = true; # config diff --git a/modules/nixos/features/tlp.nix b/modules/nixos/features/tlp.nix new file mode 100644 index 0000000..0db2b9c --- /dev/null +++ b/modules/nixos/features/tlp.nix @@ -0,0 +1,27 @@ +{ config, lib, ... }: +let + feature = "feature"; +in +{ + config = lib.mkIf config.${feature}.enable { + # Disable if devices take long to unsuspend (keyboard, mouse, etc) + powerManagement.powertop.enable = true; + services = { + power-profiles-daemon.enable = false; + tlp = { + enable = true; + settings = { + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + STOP_CHARGE_THRESH_BAT0 = 95; + }; + }; + }; + }; + + imports = [ ]; + + options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; +}