From 5e4f5858424136b797e1161a25ec642c4bf4a96b Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Sun, 16 Jun 2024 20:37:35 +0200 Subject: [PATCH] framenix: set battery charge limit of 85% at boot --- hosts/framenix/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hosts/framenix/default.nix b/hosts/framenix/default.nix index de8c815..feb58c5 100644 --- a/hosts/framenix/default.nix +++ b/hosts/framenix/default.nix @@ -35,6 +35,18 @@ in "amdgpu.abmlevel=1" # adaptive backlight management ]; + # at boot by default, limit charging capacity to protect battery. + # Hopefully there's gonna be a standard interface to control this from the desktop at some point. + systemd.services.battery-charge-limit = { + wantedBy = [ "basic.target" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${lib.getExe pkgs.framework-tool} --driver portio --charge-limit 85"; + RemainAfterExit = true; + }; + }; + + boot.loader = { systemd-boot.enable = true; efi.canTouchEfiVariables = true;