conferences | speakers | series

Introduction to G-Expressions

home

Introduction to G-Expressions
FOSDEM 2020

This talk will present an overview of G-Expressions and how the GNU Guix project uses them.

The GNU Guix project invented G-Expressions to make it easier to "stage" data or code, in the form of S-Expressions, for later manipulation or evaluation. They are similar to S-Expressions, hence the name, but they provide useful code staging features beyond what can be easily accomplished with just "quasiquote" and "unquote". A high-level object (such as a Guix package) can be included in a G-Expression; the transitive dependencies of that high-level object will then be automatically carried along with the G-Expression. When the G-Expression is converted to an S-Expression and stored on disk for later manipulation or evaluation, the high-level object will be automatically "lowered" to an appropriate representation (such as the package's output path) via a "compiler". Compared to direct manipulation of S-Expressions, G-Expressions can provide a simpler and more intuitive way to stage data or code.

The Guix project uses G-Expressions to accomplish a wide variety of tasks, including:

  • Building the latest version of Guix via "guix pull"
  • Executing the "liberation" procedure to convert Mozilla Firefox's source code into GNU IceCat's source code
  • Building Docker containers from scratch
  • Executing activation actions during system boot
  • ...and more!

Speakers: Christopher Marusich