mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
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.
This commit is contained in:
parent
300868ba57
commit
8689901f95
4 changed files with 32 additions and 3 deletions
|
@ -3967,14 +3967,23 @@ object whose name is @code{emacs} is found. This package search
|
||||||
facility is implemented in the @code{(gnu packages)} module.
|
facility is implemented in the @code{(gnu packages)} module.
|
||||||
|
|
||||||
@cindex customization, of packages
|
@cindex customization, of packages
|
||||||
|
@cindex package module search path
|
||||||
Users can store package definitions in modules with different
|
Users can store package definitions in modules with different
|
||||||
names---e.g., @code{(my-packages emacs)}. These package definitions
|
names---e.g., @code{(my-packages emacs)}. These package definitions
|
||||||
will not be visible by default. Thus, users can invoke commands such as
|
will not be visible by default. Thus, users can invoke commands such as
|
||||||
@command{guix package} and @command{guix build} have to be used with the
|
@command{guix package} and @command{guix build} have to be used with the
|
||||||
@code{-e} option so that they know where to find the package, or use the
|
@code{-e} option so that they know where to find the package, or use the
|
||||||
@code{-L} option of these commands to make those modules visible
|
@code{-L} option of these commands to make those modules visible
|
||||||
(@pxref{Invoking guix build, @code{--load-path}}). The latter makes it
|
(@pxref{Invoking guix build, @code{--load-path}}), or define the
|
||||||
easy to customize the distribution.
|
@code{GUIX_PACKAGE_PATH} environment variable. This environment
|
||||||
|
variable makes it easy to extend or customize the distribution and is
|
||||||
|
honored by all the user interfaces.
|
||||||
|
|
||||||
|
@defvr {Environment Variable} GUIX_PACKAGE_PATH
|
||||||
|
This is a colon-separated list of directories to search for package
|
||||||
|
modules. Directories listed in this variable take precedence over the
|
||||||
|
distribution's own modules.
|
||||||
|
@end defvr
|
||||||
|
|
||||||
The distribution is fully @dfn{bootstrapped} and @dfn{self-contained}:
|
The distribution is fully @dfn{bootstrapped} and @dfn{self-contained}:
|
||||||
each package is built based solely on other packages in the
|
each package is built based solely on other packages in the
|
||||||
|
|
|
@ -91,7 +91,18 @@ (define %package-module-path
|
||||||
;; Search path for package modules. Each item must be either a directory
|
;; 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
|
;; name or a pair whose car is a directory and whose cdr is a sub-directory
|
||||||
;; to narrow the search.
|
;; 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)
|
(define* (scheme-files directory)
|
||||||
"Return the list of Scheme files found under DIRECTORY."
|
"Return the list of Scheme files found under DIRECTORY."
|
||||||
|
|
|
@ -93,6 +93,9 @@ unset LANGUAGE
|
||||||
LC_MESSAGES=C
|
LC_MESSAGES=C
|
||||||
export LC_MESSAGES
|
export LC_MESSAGES
|
||||||
|
|
||||||
|
# Ignore user modules.
|
||||||
|
unset GUIX_PACKAGE_PATH
|
||||||
|
|
||||||
storedir="@storedir@"
|
storedir="@storedir@"
|
||||||
prefix="@prefix@"
|
prefix="@prefix@"
|
||||||
datarootdir="@datarootdir@"
|
datarootdir="@datarootdir@"
|
||||||
|
|
|
@ -274,3 +274,9 @@ EOF
|
||||||
|
|
||||||
guix package -A emacs-foo-bar -L "$module_dir" | grep 42
|
guix package -A emacs-foo-bar -L "$module_dir" | grep 42
|
||||||
guix package -i emacs-foo-bar-42 -n -L "$module_dir"
|
guix package -i emacs-foo-bar-42 -n -L "$module_dir"
|
||||||
|
|
||||||
|
# Same thing using the 'GUIX_PACKAGE_PATH' environment variable.
|
||||||
|
GUIX_PACKAGE_PATH="$module_dir"
|
||||||
|
export GUIX_PACKAGE_PATH
|
||||||
|
guix package -A emacs-foo-bar | grep 42
|
||||||
|
guix package -i emacs-foo-bar-42 -n
|
||||||
|
|
Loading…
Reference in a new issue