GNU bug report logs - #74900
[PATCH] Replace (guix build json) with (json) in node build system

Previous Next

Package: guix-patches;

Reported by: Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>

Date: Sun, 15 Dec 2024 20:31:01 UTC

Severity: normal

Tags: patch

Done: Jelle Licht <jlicht <at> fsfe.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 74900 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves <at> ngraves.fr>, jlicht <at> fsfe.org, d.khodabakhsh <at> gmail.com
Subject: [bug#74900] [PATCH v2 3/6] build-system/node: Add guile-json extension.
Date: Tue, 18 Feb 2025 00:43:54 +0100
* guix/build-system/node.scm (default-guile-json): New variable.
(node-build): Use guile-json extension.
---
 guix/build-system/node.scm | 39 ++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 425b8cd9b3..240336ea35 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -80,6 +80,12 @@ (define private-keywords
          (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
@@ -90,27 +96,28 @@ (define* (node-build name inputs
                      (outputs '("out"))
                      (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)))
-- 
2.48.1





This bug report was last modified 94 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.