summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--guix/derivations.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 210afd2ed1..c0b69e71d6 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -893,6 +893,11 @@ system, imported, and appears under FINAL-PATH in the resulting store path."
                                   #:guile-for-build guile
                                   #:local-build? #t)))
 
+(define search-path*
+  ;; A memoizing version of 'search-path' so 'imported-modules' does not end
+  ;; up looking for the same files over and over again.
+  (memoize search-path))
+
 (define* (imported-modules store modules
                            #:key (name "module-import")
                            (system (%current-system))
@@ -907,7 +912,7 @@ search path."
                       (let ((f (string-append
                                 (string-join (map symbol->string m) "/")
                                 ".scm")))
-                        (cons f (search-path module-path f))))
+                        (cons f (search-path* module-path f))))
                     modules)))
     (imported-files store files #:name name #:system system
                     #:guile guile)))