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

19 lines
379 B
Nix

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