summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-14 23:23:56 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-14 23:23:56 +0200
commit07254feb24d755a01c63b64c1df1bfb68ac469bf (patch)
treeb7ac3e49e426abca974295d6f9559609206b0abd
parent240a2775ded34730607b00eb1a77f2d1989f4011 (diff)
downloadguix-07254feb24d755a01c63b64c1df1bfb68ac469bf.tar.gz
ui: Avoid circularity with (guix gexp).
Fixes a regression introduced in 56b8210 ("guix build: Allow gexps to be
passed to '-e'.")

* guix/ui.scm (%guix-user-module): Wrap in 'delay'.
  (read/eval): Adjust accordingly.
-rw-r--r--guix/ui.scm14
1 files changed, 8 insertions, 6 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index beb41e925a..7338b82401 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -240,11 +240,13 @@ interpreted."
 
 (define %guix-user-module
   ;; Module in which user expressions are evaluated.
-  (let ((module (make-module)))
-    (beautify-user-module! module)
-    ;; Use (guix gexp) so that one can use #~ & co.
-    (module-use! module (resolve-interface '(guix gexp)))
-    module))
+  ;; Compute lazily to avoid circularity with (guix gexp).
+  (delay
+    (let ((module (make-module)))
+      (beautify-user-module! module)
+      ;; Use (guix gexp) so that one can use #~ & co.
+      (module-use! module (resolve-interface '(guix gexp)))
+      module)))
 
 (define (read/eval str)
   "Read and evaluate STR, raising an error if something goes wrong."
@@ -256,7 +258,7 @@ interpreted."
                         str args)))))
     (catch #t
       (lambda ()
-        (eval exp %guix-user-module))
+        (eval exp (force %guix-user-module)))
       (lambda args
         (leave (_ "failed to evaluate expression `~a': ~s~%")
                exp args)))))