From e10a2c61e8c03f41dce8736e20d0cad7ec0b5e01 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Sun, 1 Mar 2020 23:49:12 +0300 Subject: [PATCH] Update modules/users.nix --- modules/users.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/users.nix b/modules/users.nix index 386a3ef..9503a53 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -37,7 +37,16 @@ "/run/user/1000"; services.udev.extraRules = '' - ACTION=="remove", ATTRS{idVendor}=="1050", RUN+="${pkgs.systemd}/bin/systemctl suspend"''; + ACTION=="remove", ATTRS{idVendor}=="1050", RUN+="${pkgs.systemd}/bin/systemctl start swaylock"''; + + systemd.services.swaylock = { + description = "Lock the screen"; + serviceConfig.User = "balsoft"; + environment.XDG_RUNTIME_DIR = "/run/user/1000"; + serviceConfig.Type = "oneshot"; + path = [pkgs.swaylock]; + script = "swaylock -c ${builtins.substring 1 7 config.themes.colors.bg}"; + }; security.pam.u2f = { control = "sufficient";