Subject: [PATCH rust-team v3 75/75] gnu: Add fractal.

From: Herman Rimm <[email-masked]>
Date: Sat, 4 May 2024 13:35:47 +0200

* gnu/packages/gnome.scm (fractal): Add variable.
---
 gnu/packages/gnome.scm | 144 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 144 insertions(+)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 42f758f8d8..c445dbb8ab 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -78,6 +78,7 @@
 ;;; Copyright © 2023 Dominik Delgado Steuter <[email-masked]>
 ;;; Copyright © 2023 Zhu Zihao <[email-masked]>
 ;;; Copyright © 2024 Dariqq <[email-masked]>
+;;; Copyright © 2024 Herman Rimm <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -356,6 +357,149 @@ (define-public brasero
 features to enable users to create their discs easily and quickly.")
     (license license:gpl2+)))
 
+(define-public fractal
+  (package
+    (name "fractal")
+    (version "6")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.gnome.org/World/fractal")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1q6r4y11jrirfhb8lw1r0bnvwzr4dpkhdi2mdig6gnbcjvcwc65m"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   (substitute* "Cargo.toml"
+                     ;; Use the version used by Matrix SDK.
+                     (("qrcode = \"0.12\"") "qrcode = \"0.13\"")
+                     ;; Use vendored matrix-sdk.
+                     ((".*(git|rev) =.*") "")
+                     (("\\[dependencies.matrix-sdk\\]" all)
+                      (string-append all "\nversion = \"0.7.1\""))
+                     (("\\[dependencies.matrix-sdk-ui\\]" all)
+                      (string-append all "\nversion = \"0.7.0\"")))
+                   ;; Adjust to ashpd 0.6.2 API change.
+                   (substitute* "src/system_settings/linux.rs"
+                     (("with_args") "with_args::<ClockFormat>")
+                     (("ClockFormat::try_from.*") "setting {"))))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:install-source? #f
+       #:modules ((guix build cargo-build-system)
+                  ((guix build meson-build-system) #:prefix meson:)
+                  (guix build utils))
+       #:imported-modules ((guix build cargo-build-system)
+                           (guix build cargo-utils)
+                           (guix build json)
+                           ,@%meson-build-system-modules)
+       #:cargo-inputs
+       (("rust-ashpd" ,rust-ashpd-0.6)
+        ("rust-djb-hash" ,rust-djb-hash-0.1)
+        ("rust-eyeball-im" ,rust-eyeball-im-0.4)
+        ("rust-futures-channel" ,rust-futures-channel-0.3)
+        ("rust-futures-util" ,rust-futures-util-0.3)
+        ("rust-geo-uri" ,rust-geo-uri-0.2)
+        ("rust-gettext-rs" ,rust-gettext-rs-0.7)
+        ("rust-gstreamer" ,rust-gstreamer-0.21)
+        ("rust-gstreamer-base" ,rust-gstreamer-base-0.21)
+        ("rust-gst-plugin-gtk4" ,rust-gst-plugin-gtk4-0.11)
+        ("rust-gstreamer-pbutils" ,rust-gstreamer-pbutils-0.21)
+        ("rust-gstreamer-play" ,rust-gstreamer-play-0.21)
+        ("rust-gstreamer-video" ,rust-gstreamer-video-0.21)
+        ("rust-gtk" ,rust-gtk4-0.7)
+        ("rust-html-escape" ,rust-html-escape-0.2)
+        ("rust-html2pango" ,rust-html2pango-0.6)
+        ("rust-html5gum" ,rust-html5gum-0.5)
+        ("rust-image" ,rust-image-0.24)
+        ("rust-indexmap" ,rust-indexmap-2)
+        ("rust-libadwaita" ,rust-libadwaita-0.5)
+        ("rust-libshumate" ,rust-libshumate-0.4)
+        ("rust-matrix-sdk" ,rust-matrix-sdk-0.7)
+        ("rust-matrix-sdk-ui" ,rust-matrix-sdk-ui-0.7)
+        ("rust-mime" ,rust-mime-0.3)
+        ("rust-mime-guess" ,rust-mime-guess-2)
+        ("rust-once-cell" ,rust-once-cell-1)
+        ("rust-oo7" ,rust-oo7-0.2)
+        ("rust-pulldown-cmark" ,rust-pulldown-cmark-0.9)
+        ("rust-qrcode" ,rust-qrcode-0.13)
+        ("rust-rand" ,rust-rand-0.8)
+        ("rust-regex" ,rust-regex-1)
+        ("rust-rmp-serde" ,rust-rmp-serde-1)
+        ("rust-rqrr" ,rust-rqrr-0.6)
+        ("rust-ruma" ,rust-ruma-0.9)
+        ("rust-secular" ,rust-secular-1)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-sourceview5" ,rust-sourceview5-0.7)
+        ("rust-strum" ,rust-strum-0.25)
+        ("rust-thiserror" ,rust-thiserror-1)
+        ("rust-tokio" ,rust-tokio-1)
+        ("rust-tracing" ,rust-tracing-0.1)
+        ("rust-tracing-subscriber" ,rust-tracing-subscriber-0.3)
+        ("rust-url" ,rust-url-2))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'configure-meson
+           (lambda* (#:key outputs #:allow-other-keys #:rest args)
+             (apply (assoc-ref meson:%standard-phases 'configure)
+                    #:build-type "debugoptimized"
+                    #:configure-flags '()
+                    args)
+             (install-file "../source/.cargo/config" "cargo-home")
+             (copy-recursively "../source/guix-vendor" "guix-vendor")))
+         ;; Build and install desktop, GSettings, and GResource files.
+         (replace 'build
+           (lambda* (#:key outputs #:allow-other-keys #:rest args)
+             (apply (assoc-ref meson:%standard-phases 'build) args)))
+         ;; TODO: also try cargo test with --manifest specified.
+         (replace 'check
+           (lambda* (#:key outputs #:allow-other-keys #:rest args)
+             (apply (assoc-ref meson:%standard-phases 'check)
+                    #:test-options '()
+                    args)))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys #:rest args)
+             (apply (assoc-ref meson:%standard-phases 'install) args)))
+         (add-after 'install 'glib-or-gtk-wrap
+           (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
+             (apply (assoc-ref meson:%standard-phases 'glib-or-gtk-wrap)
+                    #:inputs inputs
+                    #:outputs outputs
+                    args))))))
+    (native-inputs (list meson ninja pkg-config))
+    (inputs
+      (list cairo
+            clang
+            desktop-file-utils
+            gdk-pixbuf
+            gettext-minimal
+            glib
+            (list glib "bin")
+            graphene
+            gsettings-desktop-schemas
+            gst-plugins-bad-minimal
+            gst-plugins-base
+            gstreamer
+            gtk
+            (list gtk "bin")
+            gtksourceview
+            libadwaita
+            libshumate
+            openssl
+            pango
+            pipewire
+            xdg-desktop-portal))
+    (home-page "https://gitlab.gnome.org/World/fractal")
+    (synopsis "Matrix messaging app for GNOME written in Rust")
+    (description
+      "Fractal is a Matrix messaging app for GNOME written in Rust.  Its
+interface is optimized for collaboration in large groups, such as free
+software projects, and will fit all screens, big or small.")
+    (license license:gpl3+)))
+
 ;;; Minimal variant, used to break a cycle with Inkscape.
 (define-public libcloudproviders-minimal
   (package
-- 
2.41.0