summary refs log tree commit diff
path: root/gnu/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-24 14:05:52 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-24 14:06:09 +0200
commit8689901f95499e98e0209e75b4f268bf2af325c1 (patch)
tree46345436a0991f5b15b5aee253f66743c0f3ffa5 /gnu/packages.scm
parent300868ba57e3786dae399f3cac4fff39ad6c316f (diff)
downloadguix-8689901f95499e98e0209e75b4f268bf2af325c1.tar.gz
Introduce the 'GUIX_PACKAGE_PATH' environment variable.
* gnu/packages.scm (%package-module-path): Honor $GUIX_PACKAGE_PATH.
* test-env.in: Unset 'GUIX_PACKAGE_PATH'.
* tests/guix-package.sh: Test it.
* doc/guix.texi (Package Modules): Document it.
Diffstat (limited to 'gnu/packages.scm')
-rw-r--r--gnu/packages.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm
index ddabacd199..6d128280cc 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -91,7 +91,18 @@
   ;; Search path for package modules.  Each item must be either a directory
   ;; name or a pair whose car is a directory and whose cdr is a sub-directory
   ;; to narrow the search.
-  (list (cons %distro-root-directory "gnu/packages")))
+  (let* ((not-colon   (char-set-complement (char-set #\:)))
+         (environment (string-tokenize (or (getenv "GUIX_PACKAGE_PATH") "")
+                                       not-colon)))
+    ;; Automatically add items from $GUIX_PACKAGE_PATH to Guile's search path.
+    (for-each (lambda (directory)
+                (set! %load-path (cons directory %load-path))
+                (set! %load-compiled-path
+                      (cons directory %load-compiled-path)))
+              environment)
+
+    (make-parameter
+     (append environment `((,%distro-root-directory . "gnu/packages"))))))
 
 (define* (scheme-files directory)
   "Return the list of Scheme files found under DIRECTORY."