Prevent laptop from suspending when lid is closed if on AC

Before I go and implement this myself, does anyone happen to have a nixos module in their config that configures their laptop such that it does not suspend when the lid is closed if it is on AC wall power?

This looks like a pretty clear description of how to do it, which could be adapted for NixOS: Prevent suspend on lid close with systemd –, but if anyone’s already done the work, I’d love to steal your work.

1 Like

I think this should work:

services.logind.lidSwitchExternalPower = "ignore";

Brilliant!! Thank you for pointing me to that.