build-system/tree-sitter: Add guile-json extension.

* guix/build-system/tree-sitter.scm (default-guile-json): New variable.
(tree-sitter-cross-build, tree-sitter-build): Use guile-json extension.

Signed-off-by: Jelle Licht <jlicht@fsfe.org>
Change-Id: Ib6124d7bde26e6c6711905a651858e9d99a61a1f
This commit is contained in:
Nicolas Graves 2025-02-18 00:43:57 +01:00 committed by Andreas Enge
parent c48019577c
commit 1f25dff3e1
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3

View file

@ -36,6 +36,12 @@
`((guix build tree-sitter-build-system)
,@%node-build-system-modules))
(define (default-guile-json)
"Return the default guile-json package."
;; Lazily resolve the binding to avoid a circular dependency.
(let ((mod (resolve-interface '(gnu packages guile))))
(module-ref mod 'guile-json-4)))
(define* (lower name
#:key source inputs native-inputs outputs system target
#:allow-other-keys
@ -99,10 +105,12 @@
(search-paths '())
(system (%current-system))
(guile #f)
(guile-json (default-guile-json))
(imported-modules %tree-sitter-build-system-modules)
(modules '((guix build utils)
(guix build tree-sitter-build-system))))
(define builder
(with-extensions (list guile-json)
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
@ -117,7 +125,7 @@
'#$(sexp->gexp
(map search-path-specification->sexp
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
#:inputs #$(input-tuples->gexp inputs))))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f)))
@ -137,6 +145,7 @@
(search-paths '())
(native-search-paths '())
(system (%current-system))
(guile-json (default-guile-json))
(build (nix-system->gnu-triplet system))
(imported-modules
%tree-sitter-build-system-modules)
@ -144,6 +153,7 @@
'((guix build utils)
(guix build tree-sitter-build-system))))
(define builder
(with-extensions (list guile-json)
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
@ -177,7 +187,7 @@
'#$(sexp->gexp
(map
search-path-specification->sexp
native-search-paths))))))
native-search-paths)))))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f)))