Files
nixos-flake/lock-suspend.nix
T
2026-01-11 20:18:21 +01:00

20 lines
406 B
Nix

{ config, pkgs, ... }:
{
services.logind = {
enable = true;
lidSwitch = "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 -n";
};
install.wantedBy = [ "sleep.target" ];
};
}