Setting up GNU Guix

Table of Contents

Background – Why setting up a new system?

I’ve been using Emacs since around 2016, and started using Guix in 2020. Even though I’ve been using them for years at this point, I’m missing a lot of basic knowledge for efficiently working with them.

I started using the Spacemacs Emacs distribution when I encountered Windows DLL hell for my vim installation. I found the vim emulation (evil-mode) the best I’d ever used, and started embracing Emacs. I later migrated to Doom Emacs as Spacemacs was very slow on Windows. I’ve never used plain Emacs, and don’t really know what is Emacs, what is the different plugins, and what is the distribution.

I’ve been running GNU/Linux on my personal computer since 1999 and tried many distributions. I tried Nix for some time too, but I never could get into the Nix language with limited time available (this was before much documentation existed). Migrating to Guix was a natural move given I was spending more and more time with various lisps (mostly Common Lisp).

My initial plan

My plan is to start pretty much from scratch; set up a Guix system (in a virtual machine) and configure Emacs and Guix from scratch. I also want to embrace Guix, e.g. by using Emacs packages through Guix and Guix Home. This means the configuration won’t be transferable to Windows, but this is a learning experience and won’t matter that much – unless I come to the conclusion that I simply cannot use Windows anymore and have to change my job ;)

GNU Guix – an advanced GNU/Linux distribution

  • Liberating. Guix is a distribution of the GNU operating system developed by the GNU Project—which respects the freedom of computer users.
  • Dependable. Guix supports transactional upgrades and roll-backs, unprivileged package management, and more. When used as a standalone distribution, Guix supports declarative system configuration for transparent and reproducible operating systems.
  • Hackable. It provides Guile Scheme APIs, including high-level embedded domain-specific languages (EDSLs) to define packages and whole-system configurations.

https://guix.gnu.org/

GNU Guile Scheme

Guile is the GNU Ubiquitous Intelligent Language for Extensions, and the official extension language of the GNU project.

https://www.gnu.org/software/guile/

Guile is a Scheme, which is a lisp, which is both powerful and flexible. Started in 1993 and still actively maintained. Supports R5RS, R6RS and R7RS.

NonGuix for non-free software on Guix

Nonguix is a software repository for the GNU Guix package manager, which packages some software which cannot be included in the official distribution for ethical or policy-related reasons.

https://gitlab.com/nonguix/nonguix

GNU only endorse free (as in freedom) software. Guix only includes the GNU Hurd and Linux-libre kernels. The former is not usable for production, and the latter is stipped of binary blobs. It does not include proprietary firmware packages either. You might require some non-free software on your computer, a common scenario being WiFi drivers. Nonguix serves this purpose, but please respect the GNUs guidelines regarding non-free software and keep discussions out of GNU forums.

H-Node is a great resource for finding hardware with free drivers.

Reproducible Development Environments (RDE)

Developer and power user friendly GNU/Linux distribution based on GNU Guix package manager.

This document describes rde version 0.5.0, the GNU/Linux distribution, a set of tools for managing development environments, home environments, and operating systems, a set of predefined configurations, practices and workflows.

https://sr.ht/~abcdw/rde/

Andrew Tropin (@abcdw@fosstodon.org) has created a distribution on top of Guix which seems to configure a lot of the software I expect to experiment with.

He has created a lot of videos on Guile, Guix, rde and more at andrewtropin@diode.zone.

System Crafters

System Crafters is a community and learning resource for computer enthusiasts who are interested in crafting their computing experience to increase their enjoyment and productivity.

This website is intended to be the most comprehensive reference on the internet for learning how to leverage tools like GNU Emacs, GNU Guix, and GNU/Linux to craft a fully customized workflow using Free Software tools!

https://systemcrafters.net/

David Wilson (@daviwil@fosstodon.org) has created a lot of presentations, videos and streams for configuring many of the same tools I’ll be using.

See System Crafters YouTube Channel.

Installing Guix System

The System installation (guix manual) has nice documentation on all these (except non-free) methods of installation.

VM image from Guix

The fastest way to try Guix is to download the QEMU copy-on-write image from the FTP and launch it directly.

wget https://ftp.gnu.org/gnu/guix/guix-system-vm-image-1.4.0.x86_64-linux.qcow2
sudo qemu-system-x86_64 \
   -nic user,model=virtio-net-pci \
   -enable-kvm -m 8096 \
   -device virtio-blk,drive=myhd \
   -drive if=none,file=guix-system-vm-image-1.4.0.x86_64-linux.qcow2,id=myhd

Ref

ISO from Guix

If your hardware is supported, you can install using the Guix ISO. Ref USB Stick and DVD Installation (guix manual).

ISO from NonGuix

For hardware requiring non-free software, you can use the NonGuix ISO. Ref NonGuix releases

ISO from SystemCrafters

Building our own qcow2 image

If you already have Guix installed, it’s easy to build your own images. Copy vm-image.templ, tweak to your liking, and run guix system image on the file. If building a qcow2 directly, you’ll need to copy it out of the read-only file system and make it writable.

guix system image \
    --image-type=qcow2 \
    --image-size=50G \
    ~/code/sijo-guix-channel/images/sijo-vm-image.scm

Note that your hash will be different, so look at the output from the above command.

cd ~
cp /gnu/store/8z7k3szjdw3nx7wws6r7jbygvrsc6f1p-image.qcow2 .
chmod +w 8z7k3szjdw3nx7wws6r7jbygvrsc6f1p-image.qcow2
cd ~
sudo qemu-system-x86_64 \
   -nic user,model=virtio-net-pci \
   -enable-kvm -m 8096 \
   -device virtio-blk,drive=myhd \
   -drive if=none,file=8z7k3szjdw3nx7wws6r7jbygvrsc6f1p-image.qcow2,id=myhd

Create your own custom installation media

If needed, you can quite easily create your own too. I’ve created one which set keyboard layout.

guix system image \
    --load-path=~/code/sijo-guix-channel \
    --image-type=iso9660 \
    ~/code/sijo-guix-channel/sijo/system/install.scm

NonGuix from source code

This is the method I used when installing Guix on bare-metal. Install the Guix package manager, clone the NonGuix repository, create a installation system image, flash a USB drive with this image, boot from the USB, follow installation instructions to install on physical drive.

You can skip several steps by just using the NonGuix release ISO directly.

git clone git@gitlab.com:nonguix/nonguix.git ~/code/nonguix
guix system image \
    --load-path=~/code/nonguix \
    --image-type=iso9660 \
    ~/code/nonguix/nongnu/system/install.scm

Ref

Getting help

Date: 2024-06-28 Fri 00:00

Author: Simen Endsjø

Created: 2024-07-13 Sat 17:27