From 9df5e1da1953788cb4aa6ff16367f9c181e8bf0e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 6 Dec 2021 13:58:13 +0300 Subject: feat(tazjin/tverskoy): Configure tlp to keep battery between 40-70% This is supposedly better for battery health, and since the machine is usually plugged in while in the office it might be a good idea. Note for myself: `sudo tlp fullcharge` ~30 min before needing to leave with a fully charged battery. Change-Id: I3664264403f56c15e055822190f30c3a90c93ead --- users/tazjin/nixos/tverskoy/default.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'users/tazjin') diff --git a/users/tazjin/nixos/tverskoy/default.nix b/users/tazjin/nixos/tverskoy/default.nix index 5a87c4df3e..f44bab62d8 100644 --- a/users/tazjin/nixos/tverskoy/default.nix +++ b/users/tazjin/nixos/tverskoy/default.nix @@ -32,7 +32,7 @@ in lib.fix(self: { ]; }; - boot = { + boot = rec { initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; initrd.kernelModules = [ ]; @@ -41,8 +41,10 @@ in lib.fix(self: { zfs rollback -r zpool/ephemeral/home@tazjin-clean ''; + # Install thinkpad modules for TLP + extraModulePackages = [ kernelPackages.acpi_call ]; + kernelModules = [ "kvm-amd" "i2c_dev" ]; - extraModulePackages = [ ]; kernelPackages = pkgs.linuxPackages_latest; loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; @@ -162,7 +164,6 @@ in lib.fix(self: { redshift.enable = true; blueman.enable = true; mullvad-vpn.enable = true; - tlp.enable = true; fwupd.enable = true; printing.enable = true; @@ -172,6 +173,14 @@ in lib.fix(self: { SUBSYSTEM=="i2c-dev", ACTION=="add", DEVPATH=="/devices/pci0000:00/0000:00:08.1/0000:06:00.0/i2c-5/i2c-dev/i2c-5", SYMLINK+="i2c-amdgpu-dm", TAG+="uaccess" ''; + # Configure TLP to keep battery charge between 40-70% while + # plugged in to the wall (thanks etu for the recommendation). + tlp = { + enable = true; + settings.START_CHARGE_THRESH_BAT0 = 40; + settings.STOP_CHARGE_THRESH_BAT0 = 70; + }; + xserver = { enable = true; layout = "us"; -- cgit 1.4.1