Subject: [PATCH v2 70/71] gnu: Add mautrix-whatsapp.

From: Miguel Ángel Moreno <[email-masked]>
Date: Sun, 11 Feb 2024 23:09:35 +0100

* gnu/packages/matrix.scm (mautrix-whatsapp): New variable.

Change-Id: I8ad2f1663b2421812c541d88a465ab6862bbb4ca
---
 gnu/packages/matrix.scm | 73 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/gnu/packages/matrix.scm b/gnu/packages/matrix.scm
index 49b274597a..c8cff1818b 100644
--- a/gnu/packages/matrix.scm
+++ b/gnu/packages/matrix.scm
@@ -36,6 +36,8 @@ (define-module (gnu packages matrix)
   #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages syncthing)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
@@ -91,6 +93,77 @@ (define-public go-maunium-net-go-mautrix
 @end itemize")
     (license license:mpl2.0)))
 
+(define-public mautrix-whatsapp
+  (package
+    (name "mautrix-whatsapp")
+    (version "0.8.3")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mautrix/whatsapp")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1061fx06xk1mf1j1sbgyfcc5g1jkn5jpv56r04cj0gixd0lqlb5d"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:install-source? #f
+      #:import-path "maunium.net/go/mautrix-whatsapp"
+      #:go go-1.19
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'build 'fix-symlinks
+            (lambda _
+              (delete-file-recursively "src/go.mau.fi/whatsmeow")
+              (copy-recursively (string-append #$(this-package-input
+                                                  "go-mau-fi-whatsmeow")
+                                               "/src/go.mau.fi/whatsmeow")
+                                (string-append (getenv "GOPATH")
+                                               "/src/go.mau.fi/whatsmeow"))
+              (delete-file-recursively
+               "src/github.com/chai2010/webp")
+              (copy-recursively
+               (string-append #$(this-package-input
+                                 "go-github-com-chai2010-webp")
+                              "/src/github.com/chai2010/webp")
+               (string-append (getenv "GOPATH")
+                              "/src/github.com/chai2010/webp"))
+              (delete-file-recursively
+               "src/maunium.net/go/mautrix")
+              (copy-recursively
+               (string-append #$(this-package-input
+                                 "go-maunium-net-go-mautrix")
+                              "/src/maunium.net/go/mautrix")
+               (string-append (getenv "GOPATH")
+                              "/src/maunium.net/go/mautrix")))))))
+    (native-inputs (list libolm ffmpeg))
+    (propagated-inputs
+     (list go-github-com-chai2010-webp
+           go-github-com-gorilla-mux
+           go-github-com-gorilla-websocket
+           go-github-com-lib-pq
+           go-github-com-mattn-go-sqlite3
+           go-github-com-prometheus-client-golang
+           go-github-com-skip2-go-qrcode
+           go-github-com-tidwall-gjson
+           go-github-com-tidwall-sjson
+           go-github-com-yuin-goldmark
+           go-golang-org-x-image
+           go-golang-org-x-text
+           go-google-golang-org-protobuf-proto
+           go-gopkg-in-yaml-v2
+           go-mau-fi-whatsmeow
+           go-maunium-net-go-mauflag
+           go-maunium-net-go-maulogger
+           go-maunium-net-go-mautrix))
+    (home-page "https://github.com/mautrix/whatsapp")
+    (synopsis "A Matrix-WhatsApp puppeting bridge")
+    (description "A Matrix-WhatsApp puppeting bridge based on
+@code{whatsmeow}.")
+    (license license:agpl3)))
+
 (define-public python-matrix-client
   (package
     (name "python-matrix-client")
-- 
2.41.0

-- 
Best regards,
Miguel Ángel Moreno