From 971ffcae9bff15eb6ac6723b4d0bba7f7c54bf0f Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 5 Apr 2022 17:51:47 -0700 Subject: create a profile for laptop --- modules/services/tlp/default.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 modules/services/tlp/default.nix (limited to 'modules/services/tlp/default.nix') diff --git a/modules/services/tlp/default.nix b/modules/services/tlp/default.nix new file mode 100644 index 0000000..2f818e5 --- /dev/null +++ b/modules/services/tlp/default.nix @@ -0,0 +1,24 @@ +# TLP power management +{ config, lib, ... }: +let cfg = config.my.services.tlp; +in { + options.my.services.tlp = { + enable = lib.mkEnableOption "TLP power management configuration"; + }; + + config = lib.mkIf cfg.enable { + services.tlp = { + enable = true; + + settings = { + # Set CPU scaling aggressively when power is not an issue + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + # Keep charge between 60% and 80% to preserve battery life + START_CHARGE_THRESH_BAT0 = 60; + STOP_CHARGE_THRESH_BAT0 = 80; + }; + }; + }; +} -- cgit v1.2.3