Powerlimit : Add laptop battery limiter.

This commit is contained in:
Dmitry Voronin 2024-01-24 21:09:19 +03:00
parent 457d749ab4
commit fea6c6e9fe
3 changed files with 17 additions and 2 deletions

View file

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
systemd.services.powerlimit = {
enable = true;
description = "Limit battery charge.";
serviceConfig = {
Type = "simple";
RemainAfterExit = "yes";
ExecStart = "${pkgs.bash}/bin/bash -c 'echo 40 > /sys/class/power_supply/BAT0/charge_control_start_threshold; echo 80 > /sys/class/power_supply/BAT0/charge_control_end_threshold;'";
ExecStop = "${pkgs.bash}/bin/bash -c 'echo 95 > /sys/class/power_supply/BAT0/charge_control_end_threshold; echo 90 > /sys/class/power_supply/BAT0/charge_control_start_threshold;'";
};
wantedBy = [ "multi-user.target" ];
};
}

View file

@ -3,7 +3,7 @@
{
systemd.services.powersave = {
enable = true;
description = "AMD Disable Boost";
description = "AMD disable Boost";
serviceConfig = {
Type = "simple";
RemainAfterExit = "yes";

View file

@ -3,7 +3,7 @@
{
systemd.services.powersave = {
enable = true;
description = "Intel Disable Boost";
description = "Intel disable Boost";
serviceConfig = {
Type = "simple";
RemainAfterExit = "yes";