GNU Guix provides several Scheme programming interfaces (APIs) to define, build, and query packages. The first interface allows users to write high-level package definitions. These definitions refer to familiar packaging concepts, such as the name and version of a package, its build system, and its dependencies. These definitions can then be turned into concrete build actions.
Build actions are performed by the Guix daemon, on behalf of users. In a standard setup, the daemon has write access to the store—the /gnu/store directory—whereas users do not. The recommended setup also has the daemon perform builds in chroots, under specific build users, to minimize interference with the rest of the system.
Lower-level APIs are available to interact with the daemon and the store. To instruct the daemon to perform a build action, users actually provide it with a derivation. A derivation is a low-level representation of the build actions to be taken, and the environment in which they should occur—derivations are to package definitions what assembly is to C programs. The term “derivation” comes from the fact that build results derive from them.
This chapter describes all these APIs in turn, starting from high-level package definitions.
|• Package Modules||Packages from the programmer’s viewpoint.|
|• Defining Packages||Defining new packages.|
|• Defining Package Variants||Customizing packages.|
|• Build Systems||Specifying how packages are built.|
|• Build Phases||Phases of the build process of a package.|
|• Build Utilities||Helpers for your package definitions and more.|
|• Search Paths||Declaring search path environment variables.|
|• The Store||Manipulating the package store.|
|• Derivations||Low-level interface to package derivations.|
|• The Store Monad||Purely functional interface to the store.|
|• G-Expressions||Manipulating build expressions.|
|• Invoking guix repl||Programming Guix in Guile|