Next: Invoking guix describe, Previous: Invoking guix time-machine, Up: Package Management [Contents][Index]
Note: The functionality described here is a “technology preview” as of version 1.3.0.17171-a1632. As such, the interface is subject to change.
Sometimes you might need to mix packages from the revision of Guix you’re currently running with packages available in a different revision of Guix. Guix inferiors allow you to achieve that by composing different Guix revisions in arbitrary ways.
Technically, an “inferior” is essentially a separate Guix process connected
to your main Guix process through a REPL (see Invoking guix repl). The
(guix inferior)
module allows you to create inferiors and to
communicate with them. It also provides a high-level interface to browse and
manipulate the packages that an inferior provides—inferior packages.
When combined with channels (see Channels), inferiors provide a simple way
to interact with a separate revision of Guix. For example, let’s assume you
want to install in your profile the current guile
package, along with
the guile-json
as it existed in an older revision of Guix—perhaps
because the newer guile-json
has an incompatible API and you want to
run your code against the old API. To do that, you could write a manifest for
use by guix package --manifest
(see Invoking guix package); in that
manifest, you would create an inferior for that old Guix revision you care
about, and you would look up the guile-json
package in the inferior:
(use-modules (guix inferior) (guix channels) (srfi srfi-1)) ;for 'first' (define channels ;; This is the old revision from which we want to ;; extract guile-json. (list (channel (name 'guix) (url "https://git.savannah.gnu.org/git/guix.git") (commit "65956ad3526ba09e1f7a40722c96c6ef7c0936fe")))) (define inferior ;; An inferior representing the above revision. (inferior-for-channels channels)) ;; Now create a manifest with the current "guile" package ;; and the old "guile-json" package. (packages->manifest (list (first (lookup-inferior-packages inferior "guile-json")) (specification->package "guile")))
On its first run, guix package --manifest
might have to build the
channel you specified before it can create the inferior; subsequent runs will
be much faster because the Guix revision will be cached.
The (guix inferior)
module provides the following procedures to open an
inferior:
Return an inferior for channels, a list of channels. Use the cache at cache-directory, where entries can be reclaimed after ttl seconds. This procedure opens a new connection to the build daemon.
As a side effect, this procedure may build or substitute binaries for channels, which can take time.
Open the inferior Guix in directory, running
directory/command repl
or equivalent. Return #f
if
the inferior could not be launched.
The procedures listed below allow you to obtain and manipulate inferior packages.
Return the list of packages known to inferior.
Return the sorted list of inferior packages matching name in inferior, with highest version numbers first. If version is true, return only packages with a version number prefixed by version.
Return true if obj is an inferior package.
These procedures are the counterpart of package record accessors (see package Reference). Most of them work by querying the inferior package comes from, so the inferior must still be live when you call these procedures.
Inferior packages can be used transparently like any other package or
file-like object in G-expressions (see G-Expressions). They are also
transparently handled by the packages->manifest
procedure, which is
commonly used in manifests (see the
--manifest option of guix package
). Thus you can insert
an inferior package pretty much anywhere you would insert a regular package:
in manifests, in the packages
field of your operating-system
declaration, and so on.
Next: Invoking guix describe, Previous: Invoking guix time-machine, Up: Package Management [Contents][Index]