about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJohn Titor <50095635+JohnRTitor@users.noreply.github.com>2024-05-27 14:27:24 +0530
committerJohn Titor <50095635+JohnRTitor@users.noreply.github.com>2024-05-27 17:32:22 +0530
commit07a0b79ed1c8422d92f87ab7291ea409b92c4355 (patch)
tree60f97ca60d4006ac1c0fc075ee959921c5697ca2 /nixos
parent7042f95f884ae4c836a856840f966baed4ab20f7 (diff)
nixos/hyprlock: init module
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/wayland/hyprlock.nix32
2 files changed, 33 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 76fa899ef7cef..7079413061c41 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -292,6 +292,7 @@
   ./programs/virt-manager.nix
   ./programs/wavemon.nix
   ./programs/wayland/cardboard.nix
+  ./programs/wayland/hyprlock.nix
   ./programs/wayland/hyprland.nix
   ./programs/wayland/labwc.nix
   ./programs/wayland/river.nix
diff --git a/nixos/modules/programs/wayland/hyprlock.nix b/nixos/modules/programs/wayland/hyprlock.nix
new file mode 100644
index 0000000000000..9eecb6b9bb8e7
--- /dev/null
+++ b/nixos/modules/programs/wayland/hyprlock.nix
@@ -0,0 +1,32 @@
+{ lib, pkgs, config, ... }:
+
+let
+  cfg = config.programs.hyprlock;
+in
+{
+  options.programs.hyprlock = {
+    enable = lib.mkEnableOption "hyprlock, Hyprland's GPU-accelerated screen locking utility";
+    package = lib.mkPackageOption pkgs "hyprlock" { };
+    hypridlePackage = lib.mkPackageOption pkgs "hypridle" { };
+  };
+
+  config = lib.mkIf cfg.enable {
+    environment.systemPackages = [
+      cfg.package
+      cfg.hypridlePackage
+    ];
+
+    # Hyprlock needs Hypridle systemd service to be running to detect idle time
+    systemd.user.services.hypridle = {
+      description = "Hypridle idle daemon";
+      wantedBy = [ "graphical-session.target" ];
+      partOf = [ "graphical-session.target" ];
+      script = lib.getExe cfg.hypridlePackage;
+    };
+
+    # Hyprlock needs PAM access to authenticate, else it fallbacks to su
+    security.pam.services.hyprlock = {};
+  };
+
+  meta.maintainers = with lib.maintainers; [ johnrtitor ];
+}