about summary refs log tree commit diff
path: root/users/tazjin/nixos/tverskoy/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-12-06T10·58+0300
committerVincent Ambo <mail@tazj.in>2021-12-06T13·18+0300
commit9df5e1da1953788cb4aa6ff16367f9c181e8bf0e (patch)
tree1d449d5dae1ce11a115c8b14e5a3da7e4f6dc642 /users/tazjin/nixos/tverskoy/default.nix
parent9d5483e190f27c27ed4f501f68f522ba3a80a0f5 (diff)
feat(tazjin/tverskoy): Configure tlp to keep battery between 40-70% r/3145
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
Diffstat (limited to 'users/tazjin/nixos/tverskoy/default.nix')
-rw-r--r--users/tazjin/nixos/tverskoy/default.nix15
1 files changed, 12 insertions, 3 deletions
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";