guix size command helps package developers profile the
disk usage of packages. It is easy to overlook the impact of an
additional dependency added to a package, or the impact of using a
single output for a package that could easily be split (see Packages with Multiple Outputs). Such are the typical issues that
guix size can highlight.
The command can be passed a package specification such as
guile:debug, or a file name in the store. Consider this
$ guix size coreutils store item total self /gnu/store/…-coreutils-8.23 70.0 13.9 19.8% /gnu/store/…-gmp-6.0.0a 55.3 2.5 3.6% /gnu/store/…-acl-2.2.52 53.7 0.5 0.7% /gnu/store/…-attr-2.4.46 53.2 0.3 0.5% /gnu/store/…-gcc-4.8.4-lib 52.9 15.7 22.4% /gnu/store/…-glibc-2.21 37.2 37.2 53.1%
The store items listed here constitute the transitive closure of Coreutils—i.e., Coreutils and all its dependencies, recursively—as would be returned by:
$ guix gc -R /gnu/store/…-coreutils-8.23
Here the output shows three columns next to store items. The first column, labeled “total”, shows the size in mebibytes (MiB) of the closure of the store item—that is, its own size plus the size of all its dependencies. The next column, labeled “self”, shows the size of the item itself. The last column shows the ratio of the size of the item itself to the space occupied by all the items listed here.
In this example, we see that the closure of Coreutils weighs in at 70 MiB, half of which is taken by libc. (That libc represents a large fraction of the closure is not a problem per se because it is always available on the system anyway.)
When the package passed to
guix size is available in the
guix size queries the daemon to determine its
dependencies, and measures its size in the store, similar to
-ms --apparent-size (see du invocation in GNU
When the given package is not in the store,
reports information based on the available substitutes
(see Substitutes). This makes it possible it to profile disk usage of
store items that are not even on disk, only available remotely.
You can also specify several package names:
$ guix size coreutils grep sed bash store item total self /gnu/store/…-coreutils-8.24 77.8 13.8 13.4% /gnu/store/…-grep-2.22 73.1 0.8 0.8% /gnu/store/…-bash-4.3.42 72.3 4.7 4.6% /gnu/store/…-readline-6.3 67.6 1.2 1.2% … total: 102.3 MiB
In this example we see that the combination of the four packages takes 102.3 MiB in total, which is much less than the sum of each closure since they have a lot of dependencies in common.
The available options are:
Use substitute information from urls.
See the same option for
Write a graphical map of disk usage in PNG format to file.
For the example above, the map looks like this:
This option requires that
installed and visible in Guile’s module search path. When that is not
guix size fails as it tries to load it.
Consider packages for system—e.g.,