Guix System on SBC (Raspberry Pi et al)

Hi crafters,

I’m currently in the process of trying to (and then document how to do so) boot Guix System on a Raspberry Pi 3 Model B+ (which currently still runs on NixOS and serves as my home DHCP/DNS/gitolite server). As a first step I’ll probably use a custom kernel package definition based on GitHub - raspberrypi/linux: Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/ and GitHub - raspberrypi/firmware: This repository contains pre-compiled binaries of the current Raspberry Pi kernel and modules, userspace libraries, and bootloader/GPU firmware. for firmware; even though I’m not sure yet how successfull I’ll be in doing so.

Anyways, before I am (hopefully not) reinventing the wheel, I wondered if any of you have Guix System running on a SBC such as a Raspberry Pi already and would be interested in sharing configs.

6 Likes

From General to Guix

This might be of some help as a start

1 Like

Thanks for the link! I stumbled upon it already a few month ago and discarded it as it didn’t build; but yesterday I was able to investigate it a bit more, so:

  • gawk-mesboot build failed for cross-compilation, so I had to disable grafting by setting --no-grafts (there was upstream issue for this behaviour already => Grafting breaks cross-compilation)

  • the template by pantherx tries to set a bunch of environmental variables during configure phase (namely C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, LIBRARY_PATH) which I didn’t quite get why. Setting these explicitly lets the kernel compilation fail in an early stage with:

    scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory
    

    not setting it explicitly works and my kernel builds. The LIBRARY_PATH between both builds (with and without explicitly setting PATHs) doesn’t differ much; openssl is present in both in the exact same version:

    (guix230 (~)) λ sudo rg -o --pcre2 '(?<=export LIBRARY_PATH=").*' /tmp/guix- build-linux-raspberry-5.15.32.drv-{0,1}/top/environment-variables | tr -d "\"" | sed 's/:/\n/g' | sort | uniq -c
        2 /gnu/store/1sg79scj5gjbl3nm4kih5xvz1z4vn2a3-bison-3.8.2/lib
        2 /gnu/store/21a5w6ahmf8bsh3zsw36xpfs3fx23y2k-flex-2.6.4/lib
        2 /gnu/store/69wd3pd1hd3j84xr965jj2fk2qmxn0hl-openssl-3.0.8/lib
        2 /gnu/store/6k1yys9wqrfn4y41ic1win8gpnimncwj-xz-5.2.8/lib
        2 /gnu/store/brzrf6qx5d83j1zvirc1xk14wrhyx4hf-binutils-cross-aarch64-linux-gnu-2.38/lib
        2 /gnu/store/cs3hw1wnxgijjzsd61whc8ar3qy9wjd6-mpfr-4.2.0/lib
        2 /gnu/store/gr0sy0m1mv36qv54idm6cn10l3mngshq-file-5.44/lib
        2 /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib
        2 /gnu/store/hc05d76f1j3iz3v2bs5jz4fpljl1r4dj-gawk-5.2.1/lib
        2 /gnu/store/ib2n2vzqpchc3bhh9i712w5sq9zapn8d-gmp-6.2.1/lib
        2 /gnu/store/iyaad74kw54jrqzpwm5r4jagfr8dgirp-elfutils-0.187/lib
        2 /gnu/store/j8wlfmlmfvpbza6is9wv9xsd8psrxn00-bzip2-1.0.8/lib
        2 /gnu/store/l0yryi5jsa1grnvw01c9nkz9c81cv224-glibc-2.35-static/lib
        1 /gnu/store/lj75fc25zx2y9pqvfp95la84rdhlj4f8-perl-5.36.0/lib
        2 /gnu/store/rbjq50q2ik8c1glkj5f0ksnwfz64g16g-mpc-1.3.1/lib
        2 /gnu/store/visfdda934gvivwihwhlm63fdqhhcc8a-glibc-utf8-locales-2.35/lib
        2 /gnu/store/zh4x65snfis7svs6906gj1z8i7dx2j3m-binutils-2.38/lib
        1 /tmp/guix-build-linux-raspberry-5.15.32.drv-0/top/environment-variables
        1 /tmp/guix-build-linux-raspberry-5.15.32.drv-1/top/environment-variables
    

    so I’m clueless why it previously failed, fair enough, it works now.

I’m currently building an image with a 5.15 series kernel (and about a year old firmware) as it was defined in the provided template; if this works out, I’ll try to build a more recent 6.6.x series kernel with it. I’ll keep you guys updated if my RPi SBC boots with it.

I was able to boot that given pantherx image for the Raspberry PI 400 with this config a year ago, but due to lack of time I abandoned it. Resizing the filesystem afterwards was needed to reconfigure and install xserver etc

1 Like

After fixing the build failures as described above I’m able to boot from said image as well!

Next up: building a 6.6.x kernel (which should be the latest in the raspberrypi/linux repository) plus more recent firmware and see if it works as good as well! I’ll probably document the steps I did to get things up and running in a more structured way somewhere (and maybe finally make my personal guix channel public, but that’s for after writing new kernel/firmware packages from scratch as there are a few things I’d personally want to do differently).

2 Likes

@theesm you may have already seen this, but I stubled upon this patch series:
https://issues.guix.gnu.org/48314
which seems to be merged already in upstream guix. I also see some example configs in gnu/system/examples (e.g., raspberry-pi-64.tmpl).

1 Like

I wrote down my notes on how I’ve build a guix system image for my raspberry pi 3b based on the pantherx template here: Guix System On A Raspberry Pi 3b -- literatelisp.eu. It’s not really structured documentation, but a mere rambling on what difficulties and blockers I’ve encountered and what I did to build a Guix System image that boots on my raspberry pi; maybe it’s of value to someone.

5 Likes