Subject: [PATCH v3 1/5] gnu: Add Hyprland plugins.

From: Andrew Wong <[email-masked]>
Date: Tue, 1 Apr 2025 03:34:38 -0400

* gnu/packages/wm.scm (hyprland-plugin): New function.
* gnu/packages/wm.scm (borders-plus-plus): New variable.
* gnu/packages/wm.scm (csgo-vulkan-fix): New variable.
* gnu/packages/wm.scm (hyprbars): New variable.
* gnu/packages/wm.scm (hyprexpo): New variable.
* gnu/packages/wm.scm (hyprtrails): New variable.
* gnu/packages/wm.scm (hyprwinwrap): New variable.
* gnu/packages/wm.scm (xtra-dispatchers): New variable.

Change-Id: I923095e0d0cbc1c237e55a78dd2e9c1b1a3235df
---
 gnu/packages/wm.scm | 79 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index b01f63629f..a951b24b2d 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -80,6 +80,7 @@
 ;;; Copyright © 2024 Jakob Kirsch <[email-masked]>
 ;;; Copyright © 2025 Tomáš Čech <[email-masked]>
 ;;; Copyright © 2025 Ricardo Wurmus <[email-masked]>
+;;; Copyright © 2025 Andrew Wong <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -446,6 +447,84 @@ (define-public hyprland
      `((upstream-name . "source")))
     (license license:bsd-3)))
 
+(define hyprland-plugin
+  (lambda (plugin-name plugin-provision)
+    "Generate a packaged plugin from Hyprland's official plugin repository."
+    (let ((commit "1f332c09a2382cb23da0f69a6f504f8b33433831"))
+      (package
+        (name plugin-name)
+        ;; We will ignore the version tags in the repo, use the .toml file instead
+        ;; because it's a stronger promise of compatibility.
+        ;; See https://github.com/hyprwm/hyprland-plugins/issues/312
+        (version (git-version "0.48.1" "0" commit))
+        (source (origin
+                  (method git-fetch)
+                  (uri (git-reference
+                        (url "https://github.com/hyprwm/hyprland-plugins")
+                        (commit commit)))
+                  (file-name (git-file-name name version))
+                  (sha256
+                   (base32 "0sajd019n6qk17fz87p87dsbc28afwdv8h92i2f8qdmykp54gdwm"))))
+        (build-system cmake-build-system)
+        (native-inputs (list gcc-14 pkg-config))
+        (inputs (list hyprland
+                      libdrm
+                      libinput
+                      eudev
+                      pango
+                      pixman
+                      wayland
+                      libxkbcommon
+                      mesa
+                      hyprutils
+                      hyprgraphics
+                      aquamarine
+                      hyprlang))
+        (arguments (list #:cmake cmake-3.30
+                         #:tests? #f    ; no tests.
+                         #:phases
+                         #~(modify-phases %standard-phases
+                             (add-after 'unpack 'chdir
+                               (lambda _ (chdir #$plugin-name)))
+                             (replace 'install-license-files
+                               (lambda _ (install-file
+                                          "../LICENSE"
+                                          (string-append #$output "/share/doc/"
+                                                         #$name "-"
+                                                         #$version)))))))
+        (home-page (string-append "https://github.com/hyprwm/hyprland-plugins/"
+                                  plugin-name))
+        (synopsis (string-append "Hyprland plugin providing "
+                                 plugin-provision))
+        (description
+         (string-append "This is an official Hyprland plugin that provides "
+                        plugin-provision "."))
+        (license license:bsd-3)))))
+
+(define-public borders-plus-plus
+  (hyprland-plugin "borders-plus-plus" "extra borders around windows"))
+
+(define-public csgo-vulkan-fix
+  (let ((parent (hyprland-plugin "csgo-vulkan-fix"
+                                 "virtual native resolution reporting")))
+    (package (inherit parent) (inputs (modify-inputs (package-inputs parent)
+                                        (append xcb-util-wm))))))
+
+(define-public hyprbars
+  (hyprland-plugin "hyprbars" "window title bars"))
+
+(define-public hyprexpo
+  (hyprland-plugin "hyprexpo" "an exposé feature"))
+
+(define-public hyprtrails
+  (hyprland-plugin "hyprtrails" "trail effects behind windows"))
+
+(define-public hyprwinwrap
+  (hyprland-plugin "hyprwinwrap" "a window-as-wallpaper feature"))
+
+(define-public xtra-dispatchers
+  (hyprland-plugin "xtra-dispatchers" "extra dispatchers"))
+
 (define-public i3status
   (package
     (name "i3status")
-- 
2.49.0