Setting up a GNU Guix System

Table of Contents

NOTE: This post is currently in an archived state due to time constraints. While I will write new articles, I can't guarantee anymore I'll come back to this one.

I highly recommend reading the GNU Guix manual. It proves itself to be a great guidance tool and will solve most of your problems. I managed to learn Guix mostly by consulting the manual everytime I didn't know how to do something – which is at least one time per day.

NOTE: This post is written in such manner so that it's not a replacement for the official docs regarding installation and configuration, but rather it tries to supplement those with examples and clarifications in some places.

NOTE: I may change my software preferences in time, and I'm not sure if I want this to be a living document, so if it's been a few months after I published this there is a chance I already switched some of those things.

You can see my Guix configuration files on my sourcehut.

If an item is marked with a red TODO at the beginning it means that I haven't yet written all I have to say about it. I'll occasionally come back and edit this document. I just don't have the time now to make it as nice as I want.

If you're interested in Guix, keep an eye out for I plan to concentrate my Guixy stuff on there.

1 Base installation

DOCS - System Installation

I always use the graphical installation method. Here are the way I set my options through the installation process:

  • Installation and system language: English
    • Territory: United States
  • Timezone: Europe/Bucharest
  • Keyboard layout: Romanian, cedilla
  • Partitioning method: Guided - using the entire disk.
    • Partitioning scheme: Everything is one partition.
    • NOTE: I installed Guix on an SSD on both my PC and my laptop. Each of them have besides that an 1 TB HDD for which I configure the mounting after the installation.
  • Root password: **********
  • User creation: Always create at least one other user than root.
  • Desktop environment: I don't check any of them, because I configure mine after the installation.
  • Network connection service (or whatever its called): NetworkManager
  • Network service: only Mozilla NSS certificates.

After the Guix System is installed and I reboot into it, I configure my network connection. On my PC that means doing nothing as it uses a good ol' ethernet cable, but on my laptop that means connecting to WiFi with NetworkManager (see man 1 nmcli):

nmcli dev wifi con <SSID> password <password>

If your machine doesn't see any wireless devices available, it's probably because those need proprietary firmware and Guix is a system that uses only Free Software. I use an external USD dongle on my Dell laptop. Please read the Hardware Considerations chapter in the GNU Guix manual.

After that's done, I update my pull in the latest packages and I update my system:

guix pull
sudo guix system reconfigure /etc/config.scm
sudo reboot
# and after reboot
guix upgrade

I should mention that having installed Guix twice now, I have a repository with code that sets up the system and the per-profile packages for me. See Automation.

At this point I usually alter the system configuration to also mount the HDD. First, I copy the configuration file from /etc/config.scm somewhere else, maybe in $HOME, so I can edit it. I modify the file-systems field by adding another file-system record to it, mounting the HDD to /mnt/commons. The way I obtain the UUID for the disk is using the blkid program. Below is the file system config for my PC:

 (cons* (file-system
          (mount-point "/boot/efi")
          (device (uuid "7F8B-5496" 'fat32))
          (type "vfat"))
          (mount-point "/")
           (uuid "6efc0ed2-7c25-4baf-8d0c-47b51cdea75c"
          (type "ext4"))
          (mount-point "/mnt/commons")
           (uuid "24309ab1-7640-4885-ac0b-f1b044d25fb1"
          (type "ext4"))

To make changes in a config.scm file go live you need to sudo guix system reconfigure /path/to/config.scm.

2 More Guixy stuff

2.1 Setup automation

2.1.1 Configuration file

DOCS - Using the Configuration System

If you paid attention at the end of choosing the installation options, before starting the process, you were presented with a Scheme expression that represented your whole system.

This expression is saved in /etc/config.scm by default. You can copy and change it as I mentioned in the previous section. I have mine under version control so that I won't lose it and I can go back to older versions if I screw something up.

Here is my configuration file.

2.1.2 Manifests


Once upon a time when I was still on Arch, I wanted to write me a program that would allow feeding it some set of package specifications after the base installation and have it automatically install them all. It had to be nicer and more flexible than a bash script like:

pacman -Syu
pacman -S pac1 pac2 pac3 pac4 ...

Guix has this thing called a „manifest”. It allows specifying the packages that you want to have installed as a Scheme expression. It's extremely useful if you frequently have installs that require pretty much the same configuration.

Here is mine.

2.2 Guix channels

DOCS - Channels

If you wandered the GNU/Linux lands long enough you surely have heard of the Arch User Repository (AUR). I fear that Guix simply puts that to shame using channels. Basically everyone can have their own AUR and you don't need any fancy software to get access to it (I'm looking at the pile of yogurt out there), plain old guix is build with accessing channels in mind.

For now, I only use two channels: mine and Brett's. Brett has a bunch of cool Emacs, LISP and Standard ML packages on there. I have just some Haskell packages on mine at the time of writing.

2.3 Publishing substitutes

DOCS - Invoking guix publish

Though I don't have enough knowledge to talk about running a substitutes server, I find it appropriate to mention this since I talked about channels.

3 Window manager

DOCS - X Window DOCS - Desktop Services

I don't use a desktop environment because I find a lightweight WM focused on keyboard control better suited to my needs and because my right hand starts to hurt if I use the mouse for a long period of time.

I use i3-gaps. Window managers in Guix need to be started from a login manager if I recall correctly. Let's setup the our config.scm so we have both i3-gaps and a login manager.

For the window manager, I add (specification->package "i3-gaps") to my packages field and as a login manager I choose SLiM, which needs adding (service slim-service-type) to the list of services. Please refer to the documentation to read more about display managers and desktop environments.

Because SLiM respects .xsession files, I created one to dictate the startup of the X server:

export EDITOR=emacs
export TERMINAL=kitty

setxkbmap -layout ro     # set keyboard layout to Romanian
xrdb -merge .Xresources  # load the .Xresources file

nitrogen --restore       # set the wallpaper
picom -b                 # start the picom compositor
dunst &                  # start the notification daemon

xset -b                  # disable the PC speaker bell (I think)
xset -dpms               # I have no idea what this does lol

exec i3                  # start i3-gaps

I'll talk more about the programs used here later.


4 Utilities

4.1 Terminal emulator & shell

Kitty and plain old bash. Emacs' eshell looks nice, and I like the fact that I can scroll and select text using only the keyboard. I'm thinking of setting up an Emacs server so that I can quickly pop up an eshell whenever I feel the need.

4.2 TODO File manager

ranger. It's a simple and lightweight terminal file manager with vim keybindings. Yes, I use Emacs, but I like vim keys too.

For ranger to properly recognize file types you need to install the file package. It can also display previews of photos, videos or PDFs.

4.3 Music player

I only occasionally listen to music I have downloaded on my machines, and I do that using cmus.

4.4 Video player

Since I found mpv, I haven't even looked for alternatives.

4.5 Wallpapers

For setting the current wallpaper I use nitrogen. The actual wallpapers are "stolen" from Luke Smith's repository. I really recommend checking it out if you don't have the time to manually search for that one perfect wallpaper across the entire internet.

4.6 Compositor

I use picom to get transparent backgrounds on my terminal and also on Emacs. Fun fact: I'm the one that packaged picom for Guix. I found it hard to get my hands on an example configuration for picom so here's mine (which is taken from Reddit, where the poster took it from here) for anyone that may need it.

4.7 Text editor

GNU Emacs. See the Emacs section of this post.

5 Fonts, icons and cursors

For setting those up, see my other post, GNU Guix System: Fonts, icons and cursors.

My monospace font is Fira Code. I don't care about icons because I don't have a desktop environment or a graphical file manager, but regarding cursors, I use Adwaita. The default X cursors aren't that bad, but they don't scale well on HiDPI displays.

6 Typesetting

For typesetting documents I used to use raw LaTeX until I found Org mode. Since I don't need extra fancy stuff (though I think you can use LaTeX from Org to do anything you want) and I care about easily exporting to both PDF and HTML (not saying that you can't do that with LaTeX, but I find it easier with Org), nowadays I use Org for most of my documents. This article is written in Org and my school assignements and notes are written in Org.

For LaTeX, guix provides the TeX Live distribution with a lot of packages in the texlive package.

Emacs already includes Org mode by default in the latest versions, but if you want to have the newer Org, I recommend installing emacs-org with Guix. For my Emacs configuration for Org, see the Emacs section.

7 TODO Web Browser

I use IceCat and eww. I really respect what the GNU people have done with Firefox to create its libre variant.

  • talk about removing addons (and freedoms along with them) and what sites that i use need them disabled because I know people complain about "the Guix Firefox"

8 Programming

8.1 TODO Scheme

8.1.1 TODO GNU Guile

Guix comes with Guile preinstalled, because it's built on it. But if you want to do some Scheme development using GNU Guile you want to explicitly install it in your profile. That way, it will automatically add $HOME/.guix-profile/share/guile/site/$VERSION to its %load-path variable.

  • geiser

8.2 TODO Standard ML

8.3 TODO Haskell

  • stack and cabal don't work
  • custom channel

8.4 TODO OCaml

  • works really well
  • opam is great
  • utop

8.5 TODO C/C++

  • gcc-toolchain
  • ccls

9 Databases

10 TODO Emacs

  • guix
  • magit
  • org mode
  • theme
  • geiser
  • how those things help me contribute to Guix

This post has become longer than I expected. I hope it helps some of you looking to try setting up their own Guix machines.

Writing those posts is extremely fun, but also very time consuming. If you got any value of any of my writings, I invite you to consider donating to express your support, enabling me to worry a bit less about life, to add more articles and to contribute more to Free Software projects.