Packages and their dependencies form a graph, specifically a
directed acyclic graph (DAG). It can quickly become difficult to have a
mental model of the package DAG, so the
guix graph command
provides a visual representation of the DAG. By default,
guix graph emits a DAG representation in the input format of
Graphviz, so its output can be passed
directly to the
dot command of Graphviz. It can also emit an
in a Web browser, using the d3.js library.
The general syntax is:
guix graph options package…
For example, the following command generates a PDF file representing the package DAG for the GNU Core Utilities, showing its build-time dependencies:
guix graph coreutils | dot -Tpdf > dag.pdf
The output looks like this:
Nice little graph, no?
But there is more than one graph! The one above is concise: it is the
graph of package objects, omitting implicit inputs such as GCC, libc,
grep, etc. It is often useful to have such a concise graph, but
sometimes one may want to see more details.
guix graph supports
several types of graphs, allowing you to choose the level of detail:
This is the default type used in the example above. It shows the DAG of package objects, excluding implicit dependencies. It is concise, but filters out many details.
This is the package DAG, including implicit inputs.
For instance, the following command:
guix graph --type=bag-emerged coreutils | dot -Tpdf > dag.pdf
... yields this bigger graph:
At the bottom of the graph, we see all the implicit inputs of
Now, note that the dependencies of these implicit inputs—that is, the bootstrap dependencies (see Bootstrapping)—are not shown here, for conciseness.
bag-emerged, but this time including all the bootstrap
bag, but also showing origins and their dependencies.
This is the most detailed representation: It shows the DAG of derivations (see Derivations) and plain store items. Compared to the above representation, many additional nodes are visible, including build scripts, patches, Guile modules, etc.
For this type of graph, it is also possible to pass a .drv file name instead of a package name, as in:
guix graph -t derivation `guix system build -d my-config.scm`
All the types above correspond to build-time dependencies. The following graph type represents the run-time dependencies:
This is the graph of references of a package output, as returned
guix gc --references (see Invoking guix gc).
If the given package output is not available in the store,
graph attempts to obtain dependency information from substitutes.
Here you can also pass a store file name instead of a package name. For example, the command below produces the reference graph of your profile (which can be big!):
guix graph -t references `readlink -f ~/.guix-profile`
This is the graph of the referrers of a store item, as returned by
guix gc --referrers (see Invoking guix gc).
This relies exclusively on local information from your store. For
instance, let us suppose that the current Inkscape is available in 10
profiles on your machine;
guix graph -t referrers inkscape
will show a graph rooted at Inkscape and with those 10 profiles linked
It can help determine what is preventing a store item from being garbage collected.
The available options are the following:
Produce a graph output of type, where type must be one of the values listed above.
List the supported graph types.
Produce a graph using the selected backend.
List the supported graph backends.
Currently, the available backends are Graphviz and d3.js.
Consider the package expr evaluates to.
This is useful to precisely refer to a package, as in this example:
guix graph -e '(@@ (gnu packages commencement) gnu-make-final)'