How do I enable battery conservation mode on Lenovo laptops?

I have a Lenovo Y540 laptop and just installed NixOS recently. In traditional Linux distro I can do sudo echo 1 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode

But on NixOS I got a permission denied, is there a proper Nix way to do it?

I am using KDE so gnomeExtensions.ideapad will not work

Try this
echo 1 | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode

1 Like

systemd tmpfiles.d could also be used to set the value on each boot, this could be useful in a situation of dual boot where the other OS may reset the value.

If you have two batteries (this is common in Lenovo laptops, one is external and can be replaced while the internal is being used), don’t forget to apply this on both batteries.

1 Like

There is also a widget in KDE store called Lenovo Conservation Mode Switcher, which should do the same thing as the gnome extension, but on my NixOS KDE it doesn’t seams to work. It shows the current status, but can’t switch between full battery and conservation mode.
I’m new to Nix, so i don’t know what can be the problem, does it have something to do with me downloading it from kde store and not trough some nix way. Help would be much appreciated.

You may need the program power-profiles-daemon (or a similar name)