From 522f71411c3ec8cc8f282d291dd501b543cd23cf Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 23 Apr 2024 14:05:24 +0300 Subject: [PATCH] modules: move waylock to configs/lockscreen --- modules/nixos/configs/default.nix | 1 + modules/nixos/configs/lockscreen/default.nix | 4 ++++ modules/nixos/configs/lockscreen/waylock.nix | 18 ++++++++++++++++++ .../nixos/configs/window-manager/hyprland.nix | 6 +----- 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 modules/nixos/configs/lockscreen/default.nix create mode 100644 modules/nixos/configs/lockscreen/waylock.nix diff --git a/modules/nixos/configs/default.nix b/modules/nixos/configs/default.nix index c72e916..6fcd97f 100644 --- a/modules/nixos/configs/default.nix +++ b/modules/nixos/configs/default.nix @@ -7,6 +7,7 @@ ./nix.nix ./sound.nix ./system.nix + ./lockscreen ./window-manager ]; } diff --git a/modules/nixos/configs/lockscreen/default.nix b/modules/nixos/configs/lockscreen/default.nix new file mode 100644 index 0000000..2373ef4 --- /dev/null +++ b/modules/nixos/configs/lockscreen/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + imports = [ ./waylock.nix ]; +} diff --git a/modules/nixos/configs/lockscreen/waylock.nix b/modules/nixos/configs/lockscreen/waylock.nix new file mode 100644 index 0000000..552f690 --- /dev/null +++ b/modules/nixos/configs/lockscreen/waylock.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.local.window-manager.hyprland; +in +{ + options.local.lockscreen.waylock = with lib; { + enable = mkEnableOption "waylock"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [ pkgs.unstable.waylock ]; + security.pam.services.waylock .text = '' + auth required pam_unix.so try_first_pass nullok + auth optional pam_permit.so + ''; + }; +} diff --git a/modules/nixos/configs/window-manager/hyprland.nix b/modules/nixos/configs/window-manager/hyprland.nix index 6bd806a..1acbd08 100644 --- a/modules/nixos/configs/window-manager/hyprland.nix +++ b/modules/nixos/configs/window-manager/hyprland.nix @@ -16,10 +16,6 @@ in programs.gnupg.agent.pinentryFlavor = "gtk2"; - environment.systemPackages = [ pkgs.unstable.waylock ]; - security.pam.services.waylock .text = '' - auth required pam_unix.so try_first_pass nullok - auth optional pam_permit.so - ''; + local.lockscreen.waylock.enable = lib.mkDefault true; }; }