Subject: [PATCH 6/6] gnu: Add swww.

From: Jaeme Sifat <[email-masked]>
Date: Sat, 20 Jan 2024 18:30:25 -0500

* gnu/packages/wm.scm (swww): New variable.

Change-Id: I011da07f43f8554fb569b0e033863fe8a7553e3d
---
 gnu/packages/wm.scm | 80 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 78 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 959928d8e2..035651a63a 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -64,7 +64,7 @@
 ;;; Copyright © 2023 Jonathan Brielamier <[email-masked]>
 ;;; Copyright © 2023 Vessel Wave <[email-masked]>
 ;;; Copyright © 2023 Nicolas Graves <[email-masked]>
-;;; Copyright © 2023 Jaeme Sifat <[email-masked]>
+;;; Copyright © 2023, 2024 Jaeme Sifat <[email-masked]>
 ;;; Copyright © 2023 Josselin Poiret <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -89,6 +89,7 @@ (define-module (gnu packages wm)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix build-system asdf)
+  #:use-module (guix build-system cargo)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
@@ -106,8 +107,10 @@ (define-module (gnu packages wm)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages build-tools)
   #:use-module (gnu packages calendar)
-  #:use-module (gnu packages compression)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages crates-io)
+  #:use-module (gnu packages crates-graphics)
   #:use-module (gnu packages datastructures)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
@@ -1911,6 +1914,79 @@ (define-public swaybg
     (description "Swaybg is a wallpaper utility for Wayland compositors.")
     (license license:expat))) ; MIT license
 
+(define-public swww
+  (package
+    (name "swww")
+    (version "0.8.2")
+    (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/LGFae/swww")
+                      (commit (string-append "v" version))))
+                (sha256
+                 (base32
+                  "1ps10dv6a8a0hiw7p8kg64mf81pvavskmyn5xpbfw6hrc991vdlz"))
+                (file-name (git-file-name name version))))
+    (build-system cargo-build-system)
+    (arguments
+     (list
+      #:cargo-inputs
+      `(("rust-log" ,rust-log-0.4)
+        ("rust-simplelog" ,rust-simplelog-0.12)
+        ("rust-wayland-client" ,rust-wayland-client-0.31)
+        ("rust-smithay-client-toolkit" ,rust-smithay-client-toolkit-0.18)
+        ("rust-nix" ,rust-nix-0.27)
+        ("rust-keyframe" ,rust-keyframe-1)
+        ("rust-rkyv" ,rust-rkyv-0.7)
+        ("rust-rayon" ,rust-rayon-1)
+        ("rust-spin-sleep" ,rust-spin-sleep-1)
+        ("rust-sd-notify" ,rust-sd-notify-0.4)
+        ("rust-image" ,rust-image-0.24)
+        ("rust-fast-image-resize" ,rust-fast-image-resize-2)
+        ("rust-clap" ,rust-clap-4)
+        ("rust-rand" ,rust-rand-0.8)
+        ("rust-lazy-static" ,rust-lazy-static-1)
+        ("rust-lzzzz" ,rust-lzzzz-1))
+      #:cargo-development-inputs
+      `(("rust-rand" ,rust-rand-0.8)
+        ("rust-assert-cmd" ,rust-assert-cmd-2)
+        ("rust-criterion" ,rust-criterion-0.5))
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'package)
+          (add-before 'build 'build-documentation
+            (lambda* (#:key inputs #:allow-other-keys)
+              (invoke "doc/gen.sh")))
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (bin (string-append out "/bin"))
+                     (share (string-append out "/share"))
+                     (man1 (string-append share "/man/man1"))
+                     (bash-completions-dir
+                      (string-append share "/bash-completion/completions"))
+                     (zsh-completions-dir
+                      (string-append share "/zsh/site-functions"))
+                     (fish-completions-dir
+                      (string-append share "/fish/vendor_completions.d"))
+                     (elvish-completions-dir
+                      (string-append share "/elvish/lib")))
+                (install-file "target/release/swww" bin)
+                (install-file "target/release/swww-daemon" bin)
+                (copy-recursively "doc/generated" man1)
+                (install-file "completions/swww.bash" bash-completions-dir)
+                (install-file "completions/_swww" zsh-completions-dir)
+                (install-file "completions/swww.fish" fish-completions-dir)
+                (install-file "completions/swww.elv" elvish-completions-dir)))))))
+    (native-inputs (list scdoc))
+    (propagated-inputs (list lz4))
+    (home-page "https://github.com/LGFae/swww")
+    (synopsis
+     "Efficient animated wallpaper daemon for wayland controlled at runtime")
+    (description
+     "A Solution to your Wayland Wallpaper Woes (swww).  It uses minimal resources
+and provides animations for switching between backgrounds.")
+    (license license:gpl3+)))
 
 (define-public swaynotificationcenter
   (package
-- 
2.41.0