Stop PC from sleep

I have a nixos box that I am using as an HTPC. It works well except I can’t seem to stop it from going to sleep. It never did this with the previous Linux distro I had on the same hardware so I know I must be missing some configuration somewhere.

I tried setting powerManagement.enable = false; but that doesn’t seemed to have stopped it.

Can anyone point me in the right direction?

1 Like

Are you using GNOME3 desktop? Then you might need this:

  # Disable the GNOME3/GDM auto-suspend feature that cannot be disabled in GUI!
  # If no user is logged in, the machine will power down after 20 minutes.
  systemd.targets.sleep.enable = false;
  systemd.targets.suspend.enable = false;
  systemd.targets.hibernate.enable = false;
  systemd.targets.hybrid-sleep.enable = false;
4 Likes

I am not using Gnome. It is basically launching directly into Kodi using

Still, that box never needs to hibernate or suspend so I will definitely try disabling them via systemd. Thanks for the suggestion!

I have the same issue, but with the Pantheon Desktop Environment instead. Disabling power management also didn’t work for me.