diff mbox series

[bug#55903,v6,01/41] gnu: Add go-github-com-zenhack-go-notmuch.

Message ID 20220804171047.24424-1-paren@disroot.org
State New
Headers show
Series [bug#55903,v6,01/41] gnu: Add go-github-com-zenhack-go-notmuch. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

\( Aug. 4, 2022, 5:10 p.m. UTC
From: "(unmatched-parenthesis" <paren@disroot.org>

* gnu/packages/golang.scm (go-github-com-zenhack-go-notmuch): New
  variable.
---
 gnu/packages/golang.scm | 54 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 4756bcb249..aa5155f453 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -72,6 +72,7 @@  (define-module (gnu packages golang)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages lua)
+  #:use-module (gnu packages mail)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages password-utils)
   #:use-module (gnu packages pcre)
@@ -9911,3 +9912,56 @@  (define-public gopls
 server implementation for the Go programming language. It provides
 on-the-fly code linting, formatting, completion, and introspection for
 Go code in text editors supporting LSP.")))
+
+(define-public go-github-com-zenhack-go-notmuch
+  (package
+    (name "go-github-com-zenhack-go-notmuch")
+    (version "0.0.0-20211022191430-4d57e8ad2a8b")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/zenhack/go.notmuch")
+                    (commit (go-version->git-ref version))))
+              (modules '((guix build utils)))
+              ;; XXX: We need to use a snippet, because if we don't modify
+              ;; the source directly, the modifications will have to be
+              ;; reapplied for every single package that depends on this
+              ;; one.
+              (snippet
+               #~(substitute* (find-files (getcwd) "\\.go$")
+                   (("// #cgo LDFLAGS:.*$")
+                    (let ((notmuch #$notmuch))
+                      (string-append "// #cgo LDFLAGS:"
+                                     " -lnotmuch"
+                                     " -L" notmuch "/lib\n"
+                                     "// #cgo CFLAGS:"
+                                     " -I" notmuch "/include\n")))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1j2s5smjf7pp7i72dw12sm9iz961y3cy8nkm7hmrg53f6wna57h9"))))
+    (build-system go-build-system)
+    (arguments
+     (list #:import-path "github.com/zenhack/go.notmuch"
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-before 'check 'unpack-test-fixtures
+                 (lambda* (#:key inputs import-path #:allow-other-keys)
+                   (let ((fixtures (assoc-ref inputs "notmuch-fixtures")))
+                     (invoke "tar" "xf" fixtures "-C"
+                             (string-append "src/" import-path
+                                            "/fixtures"))))))))
+    (native-inputs
+     `(("notmuch-fixtures"
+        ,(origin
+          (method url-fetch)
+          (uri "http://notmuchmail.org/releases/test-databases/database-v1.tar.xz")
+          (sha256
+           (base32
+            "1lk91s00y4qy4pjh8638b5lfkgwyl282g1m27srsf7qfn58y16a2"))))))
+    (home-page "https://github.com/zenhack/go.notmuch")
+    (synopsis "Go bindings to libnotmuch")
+    (description
+     "The notmuch package provides a Go language binding to the notmuch
+email library.")
+    (license license:gpl3+)))