28 lines
800 B
Nix
28 lines
800 B
Nix
{ config, pkgs, ... }:
|
|
|
|
{
|
|
services.logind = {
|
|
settings.Login.HandleLidSwitch = "suspend"; # suspend on lid close
|
|
};
|
|
|
|
# Add the config declaratively
|
|
environment.etc."hypr/hyprlock.conf" = {
|
|
source = pkgs.writeText "hyprlock-config" ''
|
|
# hyprlock configuration
|
|
blur = 5
|
|
timeout = 0
|
|
'';
|
|
};
|
|
systemd.user.services.hyprlock-pre-suspend = {
|
|
description = "Lock screen before suspend";
|
|
wants = [ "sleep.target" ];
|
|
before = [ "sleep.target" ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
Environment = "XDG_RUNTIME_DIR=/run/user/%U WAYLAND_DISPLAY=wayland-1 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%U/bus";
|
|
ExecStart = "${pkgs.hyprlock}/bin/hyprlock -c /etc/hypr/hyprlock.conf";
|
|
};
|
|
wantedBy = [ "sleep.target" ];
|
|
};
|
|
}
|