From 48c411f1b645aa82ea32da0426026573fa01472c Mon Sep 17 00:00:00 2001 From: Don Harper Date: Tue, 1 Apr 2025 07:30:48 -0500 Subject: [PATCH] add tpl to workstation --- hosts/book/default.nix | 2 ++ hosts/loki/default.nix | 3 ++- hosts/workstation/default.nix | 2 ++ hosts/workstation/tlp.nix | 27 +++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 hosts/workstation/tlp.nix diff --git a/hosts/book/default.nix b/hosts/book/default.nix index 8922d9e..38c018a 100644 --- a/hosts/book/default.nix +++ b/hosts/book/default.nix @@ -18,6 +18,8 @@ kmscon.enable = true; kvm.enable = false; games.enable = false; + wine.enable = false; + tlp.enable = true; }; wm = { sway.enable = true; diff --git a/hosts/loki/default.nix b/hosts/loki/default.nix index 6c54624..fb8c08f 100644 --- a/hosts/loki/default.nix +++ b/hosts/loki/default.nix @@ -26,7 +26,8 @@ kmscon.enable = true; kvm.enable = true; games.enable = true; - # wine.enable = false; + wine.enable = false; + tlp.enable = true; }; wm = { sway.enable = true; diff --git a/hosts/workstation/default.nix b/hosts/workstation/default.nix index 10fdfb0..8b0b637 100644 --- a/hosts/workstation/default.nix +++ b/hosts/workstation/default.nix @@ -38,6 +38,7 @@ in { ./upgrade-diff.nix ./kmscon.nix ./wine.nix + ./tlp.nix ]; # Enable networking @@ -249,6 +250,7 @@ in { pulseaudio ruby sops + toot udiskie wireplumber wlsunset diff --git a/hosts/workstation/tlp.nix b/hosts/workstation/tlp.nix new file mode 100644 index 0000000..db7ab29 --- /dev/null +++ b/hosts/workstation/tlp.nix @@ -0,0 +1,27 @@ +{ pkgs, inputs, config, lib, ... }: +with lib; +let cfg = config.roles.tlp; +in { + options.roles.tlp = { enable = mkEnableOption "roles tlp"; }; + config = mkIf cfg.enable { + services.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 + }; + }; + }; +}