~eliasnaur/gopizero

Using Nix to build reproducible bootable images for Raspberry Pi Zero

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~eliasnaur/gopizero
read/write
git@git.sr.ht:~eliasnaur/gopizero

You can also use your local clone with git send-email.

#Using Nix to build a bootable disk image with a Go program

If you have Nix installed, a single command will build a bootable disk image:

$ nix build

Or outside the repository:

$ nix build https://git.sr.ht/~eliasnaur/gopizero

The result/disk.img file is ready to flash to an SD card and run on a Raspberry Pi Zero or Zero W. Other than the Go program itself, The image contains only the necessary firmware and a monotlithic Linux kernel.

This project is similar to gokrazy.org but using Nix to do the heavy lifting of building everything from source, fetching firmware etc.

#Running

Flash result/disk.img to an SD card and connec the Pi Zero to a HDMI monitor to see the output.

#Reproducible

The Nix flake is designed to produce reprodicible artifacts, so no matter where or who builds it, disk.img is bit-for-bit identical to other builds from the same commit.

#macOS

The project builds on NixOS or on a Linux system with Nix installed and flakes enabled. It also runs on macOS if you have a Linux builder set up.