{ config, pkgs, ... }: { services.logind = { settings.Login.HandleLidSwitch = "suspend"; # suspend on lid close }; systemd.services.hyprlock-pre-suspend = { description = "Lock screen before suspend"; serviceConfig = { Type = "oneshot"; # Run as your user ExecStart = "${pkgs.hyprlock}/bin/hyprlock"; }; wantedBy = [ "sleep.target" ]; }; }