GNU Guix Reference Card One-Off Environments Customizing Packages for version 1.1.0 https://guix.gnu.org/ guix environment --ad-hoc spec… guix command name --with-source=name=source environment containing spec… build name with a different source URL guix environment python guix command spec --with-input=spec1=spec2 environment to develop Python itself replace spec1with spec2 in the dependency graph of spec Getting Started guix environment --ad-hoc python -C -- python3 guix command spec --with-graft=spec1=spec2 run Python in a container graft spec2 in lieu of spec1in spec To read the on-line documentation run info guix guix environment -m file guix command --with-git-url=spec=URL or visit https://gnu.org/s/guix/manual/en/html_node. See create an environment for the packages in manifest file build spec from the given Git URL https://emacs-guix.gitlab.io/website/ for an interface to Guix. guix command spec --with-branch=package=branch build spec from the given Git branch of package Updating Guix guix command spec --with-commit=package=commit Specifying Packages build spec from the given Git commit of package guix describe describe current Guix Most commands take a “package specification”denoted spec in the guix pull update Guix sequel. Here are some examples: guix pull -l view history Developing Packages guix pull --commit=commit update to commit emacs Emacs package, latest version guix pull --branch=branch update to branch guix edit spec view the definition gcc-toolchain@7 GCC toolchain, version 7.x guix pull -C file update the given channels guix build spec … build packages gcc-toolchain:debug latest GCC toolchain, debug- guix build --log-file spec view the build log ging symbols guix build -K spec … build packages, keep build Channel Specifications trees on failure Channels specify Git repositories where guix pull looks for updates guix build -S spec obtain the source of spec Managing Packages to Guix and external package repositories. By default guix pull guix build --check spec rebuild a package reads ~/.config/guix/channels.scm; with -C it can take channel guix build --target=triplet … cross-compile to triplet—e.g., guix search regexp … search for packages specifications from a user-supplied file that looks like this: arm--gnueabihf guix show spec show package info guix download URL download from URL and print (cons (channel guix install spec… install packages its SHA256 hash (name ’guix-hpc) guix hash file guix upgrade [regexp] upgrade packages (url "https://gitlab.inria.fr/guix-hpc/guix-hpc.git") print the hash of file guix remove name… remove packages (branch "master")) guix graph spec | dot -Tpdf … view dependencies guix package -m file instantiate from manifest %default-channels) guix refresh spec update package definition guix package --roll-back roll back guix import repo name import name from repo guix package -l list profile generations guix package --search-paths display search paths guix package -p profile … use a different profile Managing Storage Space Creating Application Bundles

guix gc collect all garbage guix pack spec … create a tarball Manifests guix gc -C nG collect n GB of garbage guix pack -f docker spec … create a Docker image guix package -m and other commands take a “manifest” file listing guix gc -F nG ensure n GB are available guix pack -f squashfs spec … create a Singularity image packages of interest, along these lines: guix gc -d duration delete generations older than guix pack -RR spec … create a relocatable tarball duration—e.g., 1m for one guix pack -S /bin=bin spec … make /bin a symlink to the (specifications->manifest month packages’ bin directory ’("gcc-toolchain@7" "gcc-toolchain@7:debug" guix pack -m file bundle the packages from the "openmpi")) guix size spec … view package size guix gc - /gnu/store/… list run-time dependencies manifest in file guix graph -t references spec … view run-time dependencies Managing the Operating System Declaring an Operating System guix system takes a configuration file that declares the complete guix system search regexp configuration of an operating system, along these lines: search for services matching regexp guix system reconfigure file (use-modules (gnu)) reconfigure the OS according to the configuration in file (use-service-modules networking ssh) guix system list-generations [pattern] (use-package-modules certs screen) list OS generations matching pattern—e.g., 1m for one month guix system roll-back (operating-system roll back to the previous system generation (host-name "gnu") guix system delete-generations pattern (timezone "Europe/Berlin") delete generations matching pattern (locale "en_US.utf8") (keyboard-layout (keyboard-layout "us" "altgr-intl")) guix system build file build the OS declared in file (bootloader (bootloader-configuration (bootloader grub-efi-bootloader) (target "/boot/efi") Building and Running Containers (keyboard-layout keyboard-layout))) (file-systems (cons (file-system (device (file-system-label "my-root")) guix system container file (mount-point "/") produce a script that runs the OS declared in file in a container (type "ext4")) guix system docker-image file %base-file-systems)) build a Docker image of the OS declared in file (users (cons (user-account (name "charlie") Building Virtual Machines (comment "Charlie Smith") (group "users") (supplementary-groups ’("wheel" guix system vm file "audio" "video"))) produce a script that runs the OS declared in file in a VM %base-user-accounts)) guix system vm-image file produce a QCOW2 image of the OS in file ;; Globally installed packages. (packages (append (list screen nss-certs) %base-packages))

Building Operating System Images ;; System services: add sshd and DHCP to the base services. (services (append (list (service dhcp-client-service-type) guix system disk-image file (service openssh-service-type create a raw disk image for the OS declared in file (openssh-configuration guix system disk-image --file-system-type=iso9660 file (port-number 2222)))) create an ISO CD/DVD image for the OS declared in file %base-services)))

Inspecting an Operating System guix system extension-graphfile show the graph of services extensions for the OS infile guix system shepherd-graph file show the dependency graph of Shepherd services forfile

Copyright  2018, 2019, 2020 Ludovic Courtès Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at https://gnu.org/licenses/gfdl.html. The source of this document is available from https://git.sv.gnu.org/cgit/guix/maintenance.git.