This repository contains setup and management instructions for a Guix North American Build Farm.
Go to file
2024-03-21 18:20:03 -04:00
.guix/guix-na/config balg02: Minor adjustment and reformatting 2024-03-21 18:17:35 -04:00
.pubkeys Initial setup (not yet bootstrapped or thoroughly tested) 2024-03-12 00:15:19 -04:00
.gitignore Initial setup (not yet bootstrapped or thoroughly tested) 2024-03-12 00:15:19 -04:00
.guix-authorizations Make this repository a authenticated Guix channel 2024-03-18 19:29:20 -04:00
.guix-channel Make this repository a authenticated Guix channel 2024-03-18 19:29:20 -04:00
channels.scm channels.scm: Add a Guix channels file to pin dependencies 2024-03-21 18:20:03 -04:00
news.txt news: Add entry about this authenticated channel 2024-03-18 19:31:40 -04:00
README.org Initial setup (not yet bootstrapped or thoroughly tested) 2024-03-12 00:15:19 -04:00

Guix North America

This repository contains setup and management instructions for a Guix North American Build Farm.

Install Guix on debian to be used to bootstrap the Guix os installation

Optionally, the below steps can be completed within tmux or screen. Tmux was installed and used in this case using the following.

  sudo apt update
  sudo apt install tmux
  tmux

Following the Binary Installation section from the Guix manual to install guix.

  sudo apt install -y guix

This installs the Debian's packaged version of Guix, which likely is older then what's available upstream. As such, update our installation of Guix (following the Updating Guix documentation specific to foreign distros').

  sudo -i guix pull
  sudo systemctl restart guix-daemon.service

Define Guix operating-system for the machine

See: balg02.scm

Bootloader configuration

For this installation, debian and its bootloader Grub will be left in place. Because we want to retain Guix's interactions with Grub (eg. to allow for restoring from failed upgrades to an earlier generation), we will have debian's Grub chainload Guix's Grub. To do so, we will need to manually adjust Debians' Grub in order to add another menu entry, and set it as the default menu item.

Below is a snippet from debian's /etc/default/grub.

  GRUB_DEFAULT=0
  GRUB_TIMEOUT=5
  GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
  GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200n8"
  GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,115200n8"
  GRUB_TERMINAL="console serial"
  GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=1 --word=8 --parity=no --stop=1"

From this we extract the necessary guix bootloader configuration options (for serial).

serial-unit
1
serial-speed
115200
terminal-inputs
console serial
terminal-outputs
console serial

TODO Manual modifications to Debian's Grub

In /etc/default/grub we need to modify GRUB_DEFAULT=<MENU_ITEM>

TODO …

Modify grub config on debian to add an additional (and default) option to chainload Guix grub

  • Add a menuitem for Guix in /etc/grub.d/40_custom
  • Modify /etc/default/grub setting GRUB_DEFAULT=<n> where <n> is the menu item number, starting from 0, or (preferably) the menu item name/id.

Network configuration

Using the a snippet from /etc/network/interfaces below, we can extract the necessary details to configure Guix's static-networking-service.

Interface
eno8303
Address
216.37.76.55/24
Gateway
216.37.76.1
DNS Name Servers
216.37.64.2 216.37.64.3
DNS Search
genenetwork.org
  # The primary network interface
  allow-hotplug eno8303
  iface eno8303 inet static
          address 216.37.76.55/24
          gateway 216.37.76.1
          # dns-* options are implemented by the resolvconf package, if installed
          dns-nameservers 216.37.64.2 216.37.64.3
          dns-search genenetwork.org

Disk Partitioning

For this installation we are using /dev/sda (a 1.5T ssd which is faster then the alternative 3.6T ssd in the server).

Create disk partition table and layout

  parted /dev/sda mklabel gpt

Create partitions

A simple™️ partition layout is used for this installation, consisting of an EFI ESP partition, and the remaining disk partitions for use by btrfs, where btrfs subvolumes and a swapfile will be used.

  parted /dev/sda mkpart primary fat32 0% 512MiB
  parted /dev/sda mkpart primary 512MiB 100%

Create EFI partition

  parted /dev/sda set 1 esp on
  mkfs.fat -F32 /dev/sda1

Create btrfs 'pool' (file-system) and subvolumes

Create btrfs file-system
  mkfs.btrfs --label root /dev/sda2
Create btrfs subvolumes

First mount the btrfs top-level file-system.

  mount /dev/sda2 /mnt

Then create the root subvolume, and a subvolume for swapfiles.

  btrfs subvolume create /mnt/@
  btrfs subvolume create /mnt/@swap

Unmount the top-level btrfs file-system.

  umount /mnt

Mount the root subvolume.

  mount -o subvol=@,compress=zstd /dev/sda2 /mnt

Create nested subvolumes for /gnu/store and /home.

  mkdir -p /mnt/gnu

  btrfs subvolume create /mnt/gnu/store
  btrfs subvolume create /mnt/home
  btrfs subvolume create /mnt/var

Create swap

  mkdir /mnt/swap
  mount -o subvol=@swap /dev/sda2 /mnt/swap
  dd if=/dev/zero of=/mnt/swap/swapfile bs=1M count=32768
  chmod 600 /mnt/swap/swapfile
  chattr +C /mnt/swap/swapfile

  mkswap /mnt/swap/swapfile

Prepare /mnt for Guix installation

Create /boot/efi directory for UEFI boot and mount the ESP partition there.

  mkdir -p /mnt/boot/efi
  mount /dev/sda1 /mnt/boot/efi

Both root and swap are already mounted and ready due to earlier steps.

Testing

To test the configuration in a vm before deployment, the following can be used.

  $(guix time-machine -C channels.scm -- system vm -e '(@ (guix-na config balg02) %system)') -m 2G -smp 2 -nic user,model=virtio-net-pci

Bootstrap Guix

Using Guix on debian, bootstrap the machine using the configuration in Define Guix operating-system for the machine.