Powerlimit : Add laptop battery limiter.
This commit is contained in:
parent
457d749ab4
commit
fea6c6e9fe
15
.config/linux/nix/Powerlimit.nix
Normal file
15
.config/linux/nix/Powerlimit.nix
Normal 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" ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
systemd.services.powersave = {
|
systemd.services.powersave = {
|
||||||
enable = true;
|
enable = true;
|
||||||
description = "AMD Disable Boost";
|
description = "AMD disable Boost";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
RemainAfterExit = "yes";
|
RemainAfterExit = "yes";
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
systemd.services.powersave = {
|
systemd.services.powersave = {
|
||||||
enable = true;
|
enable = true;
|
||||||
description = "Intel Disable Boost";
|
description = "Intel disable Boost";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
RemainAfterExit = "yes";
|
RemainAfterExit = "yes";
|
||||||
|
|
Reference in a new issue