summary refs log tree commit diff
path: root/build-aux/compile-as-derivation.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-09-01 23:49:43 +0200
committerLudovic Courtès <ludo@gnu.org>2018-09-02 15:43:51 +0200
commit20cbd4f5f4d08bc26c22eb40b6c1e55b02e93f23 (patch)
tree99ceb9e79d7bd1e6d5e8271e31898bbb6df30e09 /build-aux/compile-as-derivation.scm
parent87284c6b48981bdf5976dba127c688f43579a24b (diff)
downloadguix-20cbd4f5f4d08bc26c22eb40b6c1e55b02e93f23.tar.gz
compile-as-derivation: Adjust %load-compiled-path.
* build-aux/compile-as-derivation.scm: Set not only %load-path but also
%load-compiled-path.  This can avoid problems where a stale .go is
loaded.
Diffstat (limited to 'build-aux/compile-as-derivation.scm')
-rw-r--r--build-aux/compile-as-derivation.scm21
1 files changed, 14 insertions, 7 deletions
diff --git a/build-aux/compile-as-derivation.scm b/build-aux/compile-as-derivation.scm
index 59a84b1415..d945a8c79c 100644
--- a/build-aux/compile-as-derivation.scm
+++ b/build-aux/compile-as-derivation.scm
@@ -20,13 +20,20 @@
 
 (use-modules (srfi srfi-26))
 
-;; Add ~/.config/guix/latest to the search path.
-(add-to-load-path
- (and=> (or (getenv "XDG_CONFIG_HOME")
-            (and=> (getenv "HOME")
-                   (cut string-append <> "/.config")))
-        (cute string-append <> "/guix/current/share/guile/site/"
-              (effective-version))))
+;; Add ~/.config/guix/current to the search path.
+(eval-when (expand load eval)
+  (and=> (or (getenv "XDG_CONFIG_HOME")
+             (and=> (getenv "HOME")
+                    (cut string-append <> "/.config/guix/current")))
+         (lambda (current)
+           (set! %load-path
+             (cons (string-append current "/share/guile/site/"
+                                  (effective-version))
+                   %load-path))
+           (set! %load-compiled-path
+             (cons (string-append current "/lib/guile/" (effective-version)
+                                  "/site-ccache")
+                   %load-compiled-path)))))
 
 (use-modules (guix) (guix ui)
              (guix git-download)