Linux: Framework 13 NixOS, sleep but screen still on 🪫 (how to fix it)
I got a Framework laptop (yay) and I put NixOS on it. But when I put the computer to sleep the screen is still on 👎, the computer is still warm 👎, and it drains battery real fast 💀.
🪫
So what gives?
Well, there are numerous people reporting similar issues with other distributions of Linux and what ended up being the issue was the Linux Kernel version. There are some background processes that stop the computer from sleeping properly. If you upgrade the Kernel then it should be fixed.
Linux Kernel after installing NixOS
After installing NixOS the Linux Kernel I had was:
$ uname -r
6.6.36
Upgrade the Kernel
Using a tip from this post add the line:
boot.kernelPackages = pkgs.linuxPackages_latest;
to your configuration.nix
file. 🤞Hope nothing breaks!
Rebuild, restart the computer and:
$ uname -r
6.9.7
And voila, at least my Framework laptop now properly "sleeps." The screen actually turns off and I'm not draining tons of battery when it's idle.
🎉
Aside: Hibernation
By default "sleep" will simply suspend Linux and that means the computer is still sort of running (everything is still in RAM). For real power savings you want to hibernate where RAM is dumped into swap memory and loaded again on boot up.
I'll have to figure out how to do that with NixOS at some point.