From c1e24c6e15db1d61efa64a977057f931fe8e9c9b Mon Sep 17 00:00:00 2001 From: Alejandro Angulo Date: Fri, 9 Jun 2023 18:05:29 -0700 Subject: [PATCH] Configured tlp for laptop --- modules/hardware/tlp/default.nix | 29 +++++++++++++++++++++++++ systems/x86_64-linux/carbon/default.nix | 1 + 2 files changed, 30 insertions(+) create mode 100644 modules/hardware/tlp/default.nix diff --git a/modules/hardware/tlp/default.nix b/modules/hardware/tlp/default.nix new file mode 100644 index 0000000..f5b7b1b --- /dev/null +++ b/modules/hardware/tlp/default.nix @@ -0,0 +1,29 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.aa.hardware.tlp; +in { + options.aa.hardware.tlp = with types; { + enable = mkEnableOption "tlp"; + }; + + config = mkIf cfg.enable { + services.tlp = { + enable = true; + settings = { + START_CHARGE_THRESH_BAT0 = 75; + # Run `tlp setcharge` to temporarily allow charging to 100% + STOP_CHARGE_THRESH_BAT0 = 80; + RESTORE_THRESHOLDS_ON_BAT = 1; + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + }; + }; + }; +} + diff --git a/systems/x86_64-linux/carbon/default.nix b/systems/x86_64-linux/carbon/default.nix index 7302a9d..f77b52c 100644 --- a/systems/x86_64-linux/carbon/default.nix +++ b/systems/x86_64-linux/carbon/default.nix @@ -21,6 +21,7 @@ }; hardware.audio.enable = true; + hardware.tlp.enable = true; system.zfs.enable = true; apps.yubikey.enable = true;