summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-02-18 00:43:54 +0100
committerAndreas Enge <andreas@enge.fr>2025-04-13 14:19:43 +0200
commit7cc5ddf7633a0f74f1454a5724038689a1677d5d (patch)
tree4f94eaedfc55aa9a6342a56c2fe64872589e79ff
parent3e9e164154af6245389af5a1781473b36263ad20 (diff)
build-system/node: Add guile-json extension.
* guix/build-system/node.scm (default-guile-json): New variable. (node-build): Use guile-json extension. Signed-off-by: Jelle Licht <jlicht@fsfe.org> Change-Id: I68eb291410fc4943395c876ba702360b4cd7be4f
-rw-r--r--guix/build-system/node.scm38
1 files changed, 23 insertions, 15 deletions
diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 425b8cd9b3..cde0ccb60e 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -80,6 +80,12 @@
(build node-build)
(arguments (strip-keyword-arguments private-keywords arguments)))))
+(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* (node-build name inputs
#:key
source
@@ -91,26 +97,28 @@
(search-paths '())
(system (%current-system))
(guile #f)
+ (guile-json (default-guile-json))
(imported-modules %node-build-system-modules)
(modules '((guix build node-build-system)
(guix build utils))))
"Build SOURCE using NODE and INPUTS."
(define builder
- (with-imported-modules imported-modules
- #~(begin
- (use-modules #$@(sexp->gexp modules))
- (node-build #:name #$name
- #:source #+source
- #:system #$system
- #:npm-flags #$npm-flags
- #:test-target #$test-target
- #:tests? #$tests?
- #:phases #$phases
- #:outputs #$(outputs->gexp outputs)
- #:search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- search-paths))
- #:inputs #$(input-tuples->gexp inputs)))))
+ (with-extensions (list guile-json)
+ (with-imported-modules imported-modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
+ (node-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:npm-flags #$npm-flags
+ #:test-target #$test-target
+ #:tests? #$tests?
+ #:phases #$phases
+ #:outputs #$(outputs->gexp outputs)
+ #:search-paths '#$(sexp->gexp
+ (map search-path-specification->sexp
+ search-paths))
+ #:inputs #$(input-tuples->gexp inputs))))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f)))