Can't enable TLP when upgrading to 21.05

When upgrading to 21.05 the build fails with:

error: while evaluating the attribute '' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:293:5:
while evaluating 'foldr' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:52:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:128:12:
while evaluating 'fold'' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:55:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:59:8:

Failed assertions:
- You have set services.power-profiles-daemon.enable = true;
which conflicts with services.tlp.enable = true;

When I disabled TLP I was able to upgrade. After the upgrade if I reenable TLP I get the same error.

I do not see services.power-profiles-daemon.enable = true; set anywhere in my configuration. Is there some other way that it is being set?

I do not see any mention of TLP in NixOS - NixOS 21.05 manual

power-profiles-daemon is part of Gnome 40, which you are probably using.
use powertop to see if p-p-d does a decent job as is for you – chances are it does and you don’t really need TLP.

That’s really cool to hear. Maybe I’ll do some benchmarking to compare.

To use TLP you have to explicitly add services.power-profiles-daemon.enable = false; in your config.
Here’s the line that includes power-profiles-daemon in gnome: nixpkgs/gnome.nix at ab0d28758e9fe82a13c0c2f96063727d4f54ecb4 · NixOS/nixpkgs · GitHub
This issue’s been mentioned here: power-profiles-daemon: init at 0.1, add service module by mvnetbiz · Pull Request #97972 · NixOS/nixpkgs · GitHub

1 Like

Side note, should this be conditionally enabled then as well?

1 Like

FYI, in my own case with Intel hardware using 21.11, according to powertop, tlp does a much better job than p-p-d.

To add a data point.
I’ve recently put NixOS on an old laptop (Lenovo X220), and enabled TLP thinking that since this is a Thinkpad and it’s old, TLP is just the thing.
Then spent several hours trying to figure out why hibernation (more specifically, waking up from hibernation) locks the laptop up cold, but only when I hibernate when on battery.

Turned out that TLP was the culprit – it put the wifi card in some sort of power saving mode that happens to break hibernation. And this is TLP’s default behavior!

So I disabled TLP and instead set powerManagement.powertop.enable = true, all good now (including power consumption).

This was another installment of “when in doubt, stay with the defaults and follow Fedora”, I suppose…