about summary refs log tree commit diff
path: root/guix.scm
diff options
context:
space:
mode:
authorAlexander_Kabui <alexanderkabua@gmail.com>2026-10-07 05:51:26 +0300
committerAlexander_Kabui <alexanderkabua@gmail.com>2026-10-07 06:00:05 +0300
commita72ea07ea2e164cd5bbc0165e4bac95cbd7907b6 (patch)
tree6d00094b5e9d6d7e04b5a8c9d502ae52c1c6a5f3 /guix.scm
parentccfa1b02dc29571ac74602479d1798d17abb9239 (diff)
downloadgenenetwork4-a72ea07ea2e164cd5bbc0165e4bac95cbd7907b6.tar.gz
guix.scm, rust-package.scm: package genenetwork4 with the xapian-rs fork (C1.3).
rust-package.scm regenerated per the house header (guix import crate -f
Cargo.lock genenetwork4) for the C1.1 lock: 289 exported crate sources
(223 existing + 66 new) plus the xapian-rs git origin
(rust-xapian-rs-0.3.0.97fd343, Alexanderlacuna fork at rev 97fd343,
sha256 the recipe lane proved -- see ~/spikes/xapian-guix-recipe/
RECIPE-REPORT.md).

guix.scm: new (inputs (list xapian)) -- the vendored xapian-rs build
script locates it through pkg-config and the cxx bridge links
libxapian into genenetwork4 itself; clang (libclang for the autocxx
codegen) and pkg-config join native-inputs, mirroring the proven
standalone fork recipe; the 66 new crate sources join native-inputs.

The git dependency needs two things the old cargo-build-system does
not do by itself (empirically confirmed with cargo vendor on this
lock): a source-replacement stanza mapping the git source onto the
vendored directory, and a .cargo-checksum.json stub in the copied
checkout (registry crates carry one inside their .crate; a git
checkout does not). A new vendor-vendored-git-dep phase adds both,
appending exactly the stanza cargo vendor emits.

Gate: guix build -f guix.scm under the pinned channels with
substitutes in ci.guix.gnu.org-first order; evidence
~/spikes/port-execution/logs/guix-c1-3.log.
Diffstat (limited to 'guix.scm')
-rw-r--r--guix.scm112
1 files changed, 111 insertions, 1 deletions
diff --git a/guix.scm b/guix.scm
index 461b9e5..81dcbc1 100644
--- a/guix.scm
+++ b/guix.scm
@@ -14,7 +14,10 @@
   (guix gexp)
   (guix packages)
   (guix build-system cargo)
+  (gnu packages llvm)      ; clang: libclang for autocxx codegen
+  (gnu packages pkg-config)
   (gnu packages python)
+  (gnu packages search)     ; xapian: the native engine links it
   (gnu packages version-control)
   (rust-package))
 
@@ -28,10 +31,41 @@
                          #:select? (lambda (file stat)
                                      (not (string-contains file "/target/")))))
     (build-system cargo-build-system)
+    ;; The xapian-rs git dependency (the native search engine's
+    ;; bindings) is vendored like every other crate, but cargo needs a
+    ;; source replacement to use the vendored copy for a git source,
+    ;; and the copied git checkout needs a .cargo-checksum.json stub
+    ;; (cargo verifies directory-source packages through it; the
+    ;; registry crates carry one inside their .crate tarball, a git
+    ;; checkout does not).  Both are done by the added phase below,
+    ;; after 'patch-cargo-checksums has run.  The stanza shape is what
+    ;; `cargo vendor` itself emits for a git dependency.
     (arguments
      (list #:install-source? #f
            #:phases
            #~(modify-phases %standard-phases
+               (add-after 'patch-cargo-checksums 'vendor-vendored-git-dep
+                 (lambda _
+                   (let* ((rev "97fd34373e8f32f747f29d981271d6ec47643481")
+                          (git-url "https://github.com/Alexanderlacuna/xapian-rs")
+                          (vendor-dir "guix-vendor")
+                          (port (open-file ".cargo/config" "a"
+                                          #:encoding "utf-8")))
+                     (format port "
+[source.\"git+~a?rev=~a\"]
+git = \"~a\"
+rev = \"~a\"
+replace-with = 'vendored-sources'
+"
+                             git-url rev git-url rev)
+                     (close-port port)
+                     (let ((xapian-dir
+                            (car (find-files vendor-dir "^rust-xapian-rs"
+                                             #:directories? #t))))
+                       (call-with-output-file
+                           (string-append xapian-dir "/.cargo-checksum.json")
+                         (lambda (port)
+                           (display "{\"files\":{}}" port)))))))
                ;; tests/*.rs (Rust) and test/python/test_*.py mirror each
                ;; other endpoint for endpoint; the Python side exercises the
                ;; REST API over real HTTP since Python can only reach the
@@ -46,9 +80,16 @@
                      (with-directory-excursion "test/python"
                        (invoke (string-append python "/bin/python3")
                                "-m" "unittest" "discover" "-v"))))))))
+    ;; xapian is a link (not just build) dependency now: the vendored
+    ;; xapian-rs build script locates it through pkg-config and the
+    ;; resulting bridge links libxapian into genenetwork4 itself.
+    (inputs
+     (list xapian))
     (native-inputs
      (list git-minimal
            python
+           clang
+           pkg-config
            rust-adler2-2.0.1
            rust-aho-corasick-1.1.5
            rust-atomic-waker-1.1.2
@@ -271,7 +312,76 @@
            rust-zerovec-0.11.8
            rust-zerovec-derive-0.11.6
            rust-zlib-rs-0.6.8
-           rust-zmij-1.0.23))
+           rust-zmij-1.0.23
+           ;; The xapian-rs git dependency and its 65-crate closure,
+           ;; added by the native-search port (regenerated lock):
+           ;; rust-xapian-rs-0.3.0.97fd343 is the fork's git origin.
+           rust-addr2line-0.25.1
+           rust-aquamarine-0.1.12
+           rust-atty-0.2.14
+           rust-autocxx-0.27.0
+           rust-autocxx-bindgen-0.71.1
+           rust-autocxx-build-0.27.1
+           rust-autocxx-engine-0.27.1
+           rust-autocxx-macro-0.27.1
+           rust-autocxx-parser-0.27.1
+           rust-backtrace-0.3.76
+           rust-backtrace-ext-0.2.1
+           rust-cexpr-0.6.0
+           rust-clang-sys-1.9.1
+           rust-codespan-reporting-0.13.1
+           rust-cxx-1.0.122
+           rust-cxxbridge-flags-1.0.122
+           rust-cxxbridge-macro-1.0.122
+           rust-cxx-gen-0.7.198
+           rust-either-1.19.0
+           rust-env-logger-0.9.3
+           rust-errno-0.3.14
+           rust-fastrand-2.5.0
+           rust-gimli-0.32.3
+           rust-glob-0.3.4
+           rust-hashbrown-0.12.3
+           rust-hermit-abi-0.1.19
+           rust-hermit-abi-0.5.3
+           rust-humantime-2.4.0
+           rust-indexmap-1.9.3
+           rust-indoc-1.0.9
+           rust-is-ci-1.2.0
+           rust-is-terminal-0.4.17
+           rust-itertools-0.10.5
+           rust-itertools-0.13.0
+           rust-itertools-0.9.0
+           rust-libloading-0.8.9
+           rust-link-cplusplus-1.0.12
+           rust-linux-raw-sys-0.12.1
+           rust-miette-5.10.0
+           rust-miette-derive-5.10.0
+           rust-minimal-lexical-0.2.1
+           rust-miniz-oxide-0.8.9
+           rust-moveit-0.6.0
+           rust-nom-7.1.3
+           rust-object-0.37.3
+           rust-owo-colors-3.5.0
+           rust-prettyplease-0.2.37
+           rust-proc-macro-error-1.0.4
+           rust-proc-macro-error-attr-1.0.4
+           rust-rustc-demangle-0.1.28
+           rust-rustix-1.1.5
+           rust-shlex-1.3.0
+           rust-smawk-0.3.3
+           rust-supports-color-2.1.0
+           rust-supports-hyperlinks-2.1.0
+           rust-supports-unicode-2.1.0
+           rust-syn-1.0.109
+           rust-tempfile-3.27.0
+           rust-terminal-size-0.1.17
+           rust-textwrap-0.15.2
+           rust-thiserror-1.0.69
+           rust-thiserror-impl-1.0.69
+           rust-unicode-linebreak-0.1.5
+           rust-unicode-width-0.1.14
+           rust-unicode-width-0.2.2
+           rust-xapian-rs-0.3.0.97fd343))
     (home-page "https://github.com/genenetwork/genenetwork4")
     (synopsis "GeneNetwork API server")
     (description "Genenetwork4 is a Rust/Axum-based API server for