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
This commit is contained in:
Vincent Ambo 2021-12-06 13:58:13 +03:00
parent 9d5483e190
commit 9df5e1da19

View file

@ -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.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
@ -41,8 +41,10 @@ in lib.fix(self: {
zfs rollback -r zpool/ephemeral/home@tazjin-clean zfs rollback -r zpool/ephemeral/home@tazjin-clean
''; '';
# Install thinkpad modules for TLP
extraModulePackages = [ kernelPackages.acpi_call ];
kernelModules = [ "kvm-amd" "i2c_dev" ]; kernelModules = [ "kvm-amd" "i2c_dev" ];
extraModulePackages = [ ];
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
loader.systemd-boot.enable = true; loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true; loader.efi.canTouchEfiVariables = true;
@ -162,7 +164,6 @@ in lib.fix(self: {
redshift.enable = true; redshift.enable = true;
blueman.enable = true; blueman.enable = true;
mullvad-vpn.enable = true; mullvad-vpn.enable = true;
tlp.enable = true;
fwupd.enable = true; fwupd.enable = true;
printing.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" 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 = { xserver = {
enable = true; enable = true;
layout = "us"; layout = "us";