[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ANN] Guix, functional package management from Guile

From: Ludovic Courtès
Subject: [ANN] Guix, functional package management from Guile
Date: Sat, 07 Jul 2012 23:55:49 +0200
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux)


I am delighted to announce Guix, a purely functional package
management tool.
  SHA1: 30d99946c67e9a015bb9817b3731765aadc533be

Guix is written in Guile Scheme.  It builds on top of the low-level
build and storage mechanisms of the Nix package manager[*], and provides
high-level APIs to describe and run arbitrary build processes, and a
declarative interface to describe and compose software packages.

Guix implements purely functional package build and composition: a build
process is a Scheme function that returns the path of its result in the
“store”–the /nix/store directory.  The store acts as a build cache,
subject to garbage collection.  Changing a bit in the build process’s
inputs (dependencies, environment variables, etc.) changes the result.

All the nifty features of Nix are inherited:

  • multiple versions or variants of packages can happily coexist;

  • the package build environment is under control, in a chroot, such
    that the result of a build process cannot be influenced by the
    outside world;

  • support for transactional upgrades and rollback;

  • per-user environments, non-root package installation;

  • etc.

Last but not least, Guix comes with an actual distro!

Granted, it has yet to grow ;-), but it showcases the main ideas:
packages are described in a high-level, hopefully intelligible way, and
their build scripts are written and customized in Scheme.  Packages may
be built with, say:

  guix-build guile


  guix-build -e '(@ (distro base) guile-2.0)'

The latter refers unambiguously to the variable bound to the package of
interest, whereas the former would pick the first package of that name.

The ‘guile-reader’ example in the above file shows package composition,
while the ‘lout’ example shows that even hostile build systems can be

Guix & Nix

Nix is really two things: a package build tool, implemented by a library
and daemon, and a special-purpose programming language.  Guix relies on
the former, but uses Scheme as a replacement for the latter.

Technically, Guix makes remote procedure calls to the ‘nix-worker’
daemon to perform operations on the store.  At the lowest level, Nix
“derivations” represent promises of a build, stored in ‘.drv’ files in
the store.  Guix produces such derivations, which are then interpreted
by the daemon to perform the build.  Thus, Guix derivations can use
derivations produced by Nix (and vice versa); in Guix, the cheat code is
the ‘nixpkgs-derivation’ procedure.  :-)

With Nix and the Nixpkgs distribution, package composition happens at
the Nix language level, but builders are usually written in Bash.
Conversely, Guix encourages the use of Scheme for both package
composition and builders.

Other noteworthy points: Guix doesn’t yet have an equivalent to
‘nix-env’; it supports multiple-derivation outputs (where a build
produces several files under /nix/store); package descriptions in the
mini-distro are internationalized; the distribution being written in
Scheme, it is compiled efficiently by Guile’s compiler.

Help needed!

It seems to me like a lot more can be done with this, and it’s fun!

If you’re a Nixer, you’re welcome to give it a try (you just need a
‘nix-worker’ instance running), attempt to build/package something, and
provide feedback on the API and declarative package expressions.

If you’re a Guiler, there are interesting challenges.  One is to write
more macros/EDSLs to provide builders with operations as high-level as
typically found in shell scripts (for instance, ‘substitute*’ attempts
to provide a sed-like API.)  Another one is to investigate whether/how
the code of builders could be generated hygienically (see

If you’re a GNU-system-discusser, feedback is welcome!  How would it fit
in a hypothetical GNU distribution?

Happy hacking & packaging!


Attachment: pgpuRCC36dyAT.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]