0% found this document useful (0 votes)
60 views2 pages

Guix Refcard

This document provides an overview of commands and usage for the GNU Guix package manager. It describes how to search, install, update and manage packages as well as develop and build packages. It also covers configuring and managing whole operating system installations with Guix.

Uploaded by

a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views2 pages

Guix Refcard

This document provides an overview of commands and usage for the GNU Guix package manager. It describes how to search, install, update and manage packages as well as develop and build packages. It also covers configuring and managing whole operating system installations with Guix.

Uploaded by

a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

GNU Guix Reference Card One-Off Environments Customizing Packages

for version 1.0.0


https://gnu.org/software/guix/ 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 spec1 with 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 spec1 in 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 Emacs interface to Guix. guix command spec --with-branch=branch
build spec from the given Git branch
Updating Guix guix command spec --with-commit=commit
Specifying Packages build spec from the given Git commit
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-linux-gnueabihf
guix package --show=spec show package info guix download URL download from URL and print
(cons (channel its SHA256 hash
guix package -i spec… install packages (name ’guix-hpc)
guix package -u [regexp] upgrade packages guix hash file print the hash of file
(url "https://gitlab.inria.fr/guix-hpc/guix-hpc.git")
guix package -r 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 packages’ bin directory
’("gcc-toolchain@7" "gcc-toolchain@7:debug"
month
guix size spec … view package size guix pack -m file bundle the packages from the
"openmpi"))
guix gc -R /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")
(comment "Charlie Smith")
Building Virtual Machines
(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))))
%base-services)))
create an ISO CD/DVD image for the OS declared in file

Inspecting an Operating System

guix system extension-graph file


show the graph of services extensions for the OS in file
guix system shepherd-graph file
show the dependency graph of Shepherd services for file
Copyright  2018, 2019 Ludovic Courtès <[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.

You might also like