Próximo: , Acima: Interface de programação   [Conteúdo][Índice]


8.1 Módulos de pacote

From a programming viewpoint, the package definitions of the GNU distribution are provided by Guile modules in the (gnu packages …) name space19 (veja Guile modules em GNU Guile Reference Manual). For instance, the (gnu packages emacs) module exports a variable named emacs, which is bound to a <package> object (veja Definindo pacotes).

The (gnu packages …) module name space is automatically scanned for packages by the command-line tools. For instance, when running guix install emacs, all the (gnu packages …) modules are scanned until one that exports a package object whose name is emacs is found. This package search facility is implemented in the (gnu packages) module.

Users can store package definitions in modules with different names—e.g., (my-packages emacs)20. There are two ways to make these package definitions visible to the user interfaces:

  1. By adding the directory containing your package modules to the search path with the -L flag of guix package and other commands (veja Opções de compilação comum), or by setting the GUIX_PACKAGE_PATH environment variable described below.
  2. By defining a channel and configuring guix pull so that it pulls from it. A channel is essentially a Git repository containing package modules. Veja Canais, for more information on how to define and use channels.

GUIX_PACKAGE_PATH works similarly to other search path variables:

Environment Variable: GUIX_PACKAGE_PATH

This is a colon-separated list of directories to search for additional package modules. Directories listed in this variable take precedence over the own modules of the distribution.

The distribution is fully bootstrapped and self-contained: each package is built based solely on other packages in the distribution. The root of this dependency graph is a small set of bootstrap binaries, provided by the (gnu packages bootstrap) module. For more information on bootstrapping, veja Inicializando.


Notas de Rodapé

(19)

Note that packages under the (gnu packages …) module name space are not necessarily “GNU packages”. This module naming scheme follows the usual Guile module naming convention: gnu means that these modules are distributed as part of the GNU system, and packages identifies modules that define packages.

(20)

Note that the file name and module name must match. For instance, the (my-packages emacs) module must be stored in a my-packages/emacs.scm file relative to the load path specified with --load-path or GUIX_PACKAGE_PATH. Veja Modules and the File System em GNU Guile Reference Manual, for details.


Próximo: Definindo pacotes, Acima: Interface de programação   [Conteúdo][Índice]