GNU Guix Reference Card One-Off Environments
for version 1.4.0 Customizing Packages
https://guix.gnu.org/ guix shell spec…
environment containing spec… guix command name --with-source=name=source
guix shell -D python build name with a different source URL
environment to develop Python itself guix command spec --with-input=spec1=spec2
Getting Started guix shell python -C -- python3 replace spec1 with spec2 in the dependency graph of spec
run Python in a container guix command spec --with-graft=spec1=spec2
To read the on-line documentation run info guix or visit guix shell --check graft spec2 in lieu of spec1 in spec
https://guix.gnu.org/manual/. See https://emacs-guix.gitlab.io/website/ check if the shell clobbers environment variables guix command --with-git-url=spec=URL
for an Emacs interface to Guix. guix shell -m file build spec from the given Git URL
create an environment for the packages in manifest file guix command spec --with-branch=package=branch
build spec from the given Git branch of package
Specifying Packages guix command spec --with-commit=package=commit
Updating Guix build spec from the given Git commit of package
Most commands take a “package specification” denoted spec in the guix command spec --with-patch=package=file
sequel. Here are some examples: guix describe describe current Guix build spec after applying the given patch file to package
guix describe -f channels produce a channel spec guix command spec --with-latest=package
emacs Emacs package, latest version guix pull update Guix build spec using the latest upstream release for package
guix pull -l view history guix command spec --with-c-toolchain=package=toolchain
gcc-toolchain@7 GCC toolchain, version 7.x
guix pull --commit=commit update to commit build spec using toolchain for package
gcc-toolchain:debug latest GCC toolchain, debug-
guix pull --branch=branch update to branch guix command spec --without-tests=package
ging symbols build spec without running the tests for package
guix pull -C file update the given channels
Managing Packages Developing Packages
Channel Specifications
guix search regexp … search for packages guix edit spec
Channels specify Git repositories where guix pull looks for updates view the definition
guix show spec show package info guix build spec …
to Guix and external package repositories. By default guix pull build packages
guix install spec… install packages guix build --log-file spec
reads ~/.config/guix/channels.scm; with -C it can take channel view the build log
guix upgrade [regexp] upgrade packages guix build -K spec …
specifications from a user-supplied file that looks like this: build packages, keep build
guix remove name… remove packages trees on failure
guix package -m file instantiate from manifest guix build -S spec obtain the source of spec
(cons (channel
guix package --export-manifest export profile contents as (name ’guix-hpc) guix build --check spec rebuild a package
manifest (url "https://gitlab.inria.fr/guix-hpc/guix-hpc.git") guix build --target=triplet … cross-compile to triplet—e.g.,
guix package --roll-back roll back (branch "master")) arm-linux-gnueabihf
guix package -I list installed packages %default-channels) guix download URL download from URL and print
guix package -l list profile generations its SHA256 hash
guix package --search-paths guix hash file print the hash of file
display search paths
guix package -p profile … guix graph spec | dot -Tpdf … view dependencies
use a different profile
Using a Different Version of Guix guix refresh spec update package definition
guix import repo name import name from repo
Manifests The guix time-machine command provides access to other revisions
of Guix, for example to install older versions of packages, or to
guix package -m and other commands take a “manifest” file listing reproduce a computation in an identical environment.
packages of interest, along these lines:
guix time-machine -C file -- commands …
(specifications->manifest Run commands in a version of Guix specified by the given
’("gcc-toolchain@7" "gcc-toolchain@7:debug"
channels in file
"openmpi"))
Creating Application Bundles Declaring an Operating System Building Operating Systems
guix pack spec … create a tarball guix system takes a configuration file that declares the complete guix system image file
guix pack -f docker spec … create a Docker image configuration of an operating system, along these lines: create a raw disk image for the OS declared in file
guix pack -f squashfs spec … create a Singularity image guix system image --image-type=iso9660 file
guix pack -f deb spec … create a Debian package create an ISO CD/DVD image for the OS declared in file
(use-modules (gnu))
archive guix system image --image-type=qcow2 file
(use-service-modules networking ssh)
guix pack -RR spec … create a relocatable tarball (use-package-modules certs screen) produce a QCOW2 image of the OS in file
guix system vm file
guix pack -S /bin=bin spec … make /bin a symlink to the
(operating-system produce a script that runs the OS declared in file in a VM
packages’ bin directory (host-name "gnu")
guix pack -m file bundle the packages from the (timezone "Europe/Berlin")
manifest in file (locale "en_US.utf8")
Managing the Operating System
(keyboard-layout (keyboard-layout "us" "altgr-intl"))
(bootloader (bootloader-configuration guix system search regexp
Managing Storage Space (bootloader grub-efi-bootloader) search for services matching regexp
(target (list "/boot/efi")) guix system reconfigure file
guix gc collect all garbage (keyboard-layout keyboard-layout))) reconfigure the OS according to the configuration in file
guix gc -C nG collect n GB of garbage (file-systems (cons (file-system guix system list-generations [pattern]
guix gc -F nG ensure n GB are available (device (file-system-label "my-root"))
list OS generations matching pattern—e.g., 1m for one month
(mount-point "/")
guix gc -d duration delete generations older than guix system roll-back
(type "ext4"))
duration—e.g., 1m for one %base-file-systems)) roll back to the previous system generation
month guix system delete-generations pattern
guix size spec … view package size (users (cons (user-account delete generations matching pattern
guix gc -R /gnu/store/… (name "charlie") guix system build file
list run-time dependencies
(comment "Charlie Smith") build the OS declared in file
guix graph -t references spec … view run-time dependencies (group "users")
(supplementary-groups ’("wheel"
"audio" "video")))
Managing the Home Environment %base-user-accounts)) Building and Running Containers
;; Globally installed packages. guix system container file
guix home takes a configuration file that declares dotfiles, packages, (packages (append (list screen nss-certs) produce a script that runs the OS declared in file in a container
and user services. %base-packages))
guix system docker-image file
;; System services: add sshd and DHCP to the base services.
build a Docker image of the OS declared in file
guix home search regexp
search for services matching regexp (services (append (list (service dhcp-client-service-type)
(service openssh-service-type
guix home reconfigure file
(openssh-configuration Inspecting an Operating System
reconfigure the home according to the configuration in file (port-number 2222))))
guix home list-generations [pattern] %base-services)))
list home generations matching pattern guix system extension-graph file
guix home delete-generations pattern
show the graph of services extensions for the OS in file
delete generations matching pattern guix system shepherd-graph file
guix home roll-back
show the dependency graph of Shepherd services for file
roll back to the previous generation
guix home build file
build the home environment declared in file
Copyright 2018, 2019, 2020 Ludovic Courtès <
[email protected]>
Copyright 2022 Ricardo Wurmus <
[email protected]>
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 Free Software 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.