Next: , Previous: , Up: Utilities   [Contents][Index]


6.5 Invoking guix import

The guix import command is useful for people willing to add a package to the distribution but who’d rather do as little work as possible to get there—a legitimate demand. The command knows of a few repositories from which it can “import” package meta-data. The result is a package definition, or a template thereof, in the format we know (see Defining Packages).

The general syntax is:

guix import importer options

importer specifies the source from which to import package meta-data, and options specifies a package identifier and other options specific to importer. Currently, the available “importers” are:

gnu

Import meta-data for the given GNU package. This provides a template for the latest version of that GNU package, including the hash of its source tarball, and its canonical synopsis and description.

Additional information such as the package’s dependencies and its license needs to be figured out manually.

For example, the following command returns a package definition for GNU Hello:

guix import gnu hello

Specific command-line options are:

--key-download=policy

As for guix refresh, specify the policy to handle missing OpenPGP keys when verifying the package’s signature. See --key-download.

pypi

Import meta-data from the Python Package Index9. Information is taken from the JSON-formatted description available at pypi.python.org and usually includes all the relevant information, including package dependencies.

The command below imports meta-data for the itsdangerous Python package:

guix import pypi itsdangerous
gem

Import meta-data from RubyGems10. Information is taken from the JSON-formatted description available at rubygems.org and includes most relevant information, including runtime dependencies. There are some caveats, however. The meta-data doesn’t distinguish between synopses and descriptions, so the same string is used for both fields. Additionally, the details of non-Ruby dependencies required to build native extensions is unavailable and left as an exercise to the packager.

The command below imports meta-data for the rails Ruby package:

guix import gem rails
cpan

Import meta-data from MetaCPAN. Information is taken from the JSON-formatted meta-data provided through MetaCPAN’s API and includes most relevant information, such as module dependencies. License information should be checked closely. If Perl is available in the store, then the corelist utility will be used to filter core modules out of the list of dependencies.

The command command below imports meta-data for the Acme::Boolean Perl module:

guix import cpan Acme::Boolean
cran

Import meta-data from CRAN, the central repository for the GNU R statistical and graphical environment.

Information is extracted from the HTML package description.

The command command below imports meta-data for the Cairo R package:

guix import cran Cairo
nix

Import meta-data from a local copy of the source of the Nixpkgs distribution11. Package definitions in Nixpkgs are typically written in a mixture of Nix-language and Bash code. This command only imports the high-level package structure that is written in the Nix language. It normally includes all the basic fields of a package definition.

When importing a GNU package, the synopsis and descriptions are replaced by their canonical upstream variant.

As an example, the command below imports the package definition of LibreOffice (more precisely, it imports the definition of the package bound to the libreoffice top-level attribute):

guix import nix ~/path/to/nixpkgs libreoffice
hackage

Import meta-data from Haskell community’s central package archive Hackage. Information is taken from Cabal files and includes all the relevant information, including package dependencies.

Specific command-line options are:

--stdin
-s

Read a Cabal file from the standard input.

--no-test-dependencies
-t

Do not include dependencies required by the test suites only.

--cabal-environment=alist
-e alist

alist is a Scheme alist defining the environment in which the Cabal conditionals are evaluated. The accepted keys are: os, arch, impl and a string representing the name of a flag. The value associated with a flag has to be either the symbol true or false. The value associated with other keys has to conform to the Cabal file format definition. The default value associated with the keys os, arch and impl is ‘linux’, ‘x86_64’ and ‘ghc’ respectively.

The command below imports meta-data for the latest version of the HTTP Haskell package without including test dependencies and specifying the value of the flag ‘network-uri’ as false:

guix import hackage -t -e "'((\"network-uri\" . false))" HTTP

A specific package version may optionally be specified by following the package name by a hyphen and a version number as in the following example:

guix import hackage mtl-2.1.3.1
elpa

Import meta-data from an Emacs Lisp Package Archive (ELPA) package repository (see Packages in The GNU Emacs Manual).

Specific command-line options are:

--archive=repo
-a repo

repo identifies the archive repository from which to retrieve the information. Currently the supported repositories and their identifiers are:

  • - GNU, selected by the gnu identifier. This is the default.
  • - MELPA-Stable, selected by the melpa-stable identifier.
  • - MELPA, selected by the melpa identifier.

The structure of the guix import code is modular. It would be useful to have more importers for other package formats, and your help is welcome here (see Contributing).


Footnotes

(9)

This functionality requires Guile-JSON to be installed. See Requirements.

(10)

This functionality requires Guile-JSON to be installed. See Requirements.

(11)

This relies on the nix-instantiate command of Nix.


Next: , Previous: , Up: Utilities   [Contents][Index]