refactor(deploy): key the Pi build machinery by board

piBaseModules hardcoded the nixos-hardware raspberry-pi-5 module and our
raspberry-pi-5.nix glue, so mkPiInstalled/mkPiImage could only ever produce
a Pi 5. Everything else in the Pi runtime is board-agnostic.

Introduce `piBoards`, keyed by machine model — the parameter already threaded
through both builders — pairing each board's nixos-hardware module with its
glue file, and have piBaseModules look the pair up. Same modules in the same
order for rpi5, so its evaluated configuration is unchanged (compared on 16
app-independent facets: kernel, params, initrd modules, loader, device tree,
video drivers, udev, filesystems, swap, nix settings, sleep targets, service
exec/memory, env seed, sshd). No new board yet — that's the next commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013A6683cCHnQxFUosx1krY4
This commit is contained in:
Padreug 2026-09-20 11:26:02 +02:00
commit 029bb09745

View file

@ -308,14 +308,26 @@
fiatCode = fiatCodeForModel.${machineModel} or "USD"; fiatCode = fiatCodeForModel.${machineModel} or "USD";
}; };
# Supported Pi boards, keyed by machine model. Each pairs the
# nixos-hardware board module (kernel, firmware, bootloader, device tree)
# with our own hardware glue (validator serial, kiosk display, no-suspend).
# Everything else in the Pi runtime is board-agnostic.
piBoards = {
rpi5 = {
hardware = nixos-hardware.nixosModules.raspberry-pi-5;
glue = ./deploy/nixos/hardware/raspberry-pi-5.nix;
};
};
# Shared module list (everything EXCEPT the root fs and the sd-image # Shared module list (everything EXCEPT the root fs and the sd-image
# builder). atm-app/fiatCode are threaded in so both products share one # builder). atm-app/fiatCode are threaded in so both products share one
# evaluated app closure. # evaluated app closure.
piBaseModules = { machineModel, atm-app, fiatCode }: [ piBaseModules = { machineModel, atm-app, fiatCode }:
nixos-hardware.nixosModules.raspberry-pi-5 let board = piBoards.${machineModel}; in [
board.hardware
./deploy/nixos/configuration.nix ./deploy/nixos/configuration.nix
./deploy/nixos/bitspire-atm.nix ./deploy/nixos/bitspire-atm.nix
./deploy/nixos/hardware/raspberry-pi-5.nix board.glue
({ config, lib, pkgs, pkgs-unstable, ... }: { ({ config, lib, pkgs, pkgs-unstable, ... }: {
services.bitspire = { services.bitspire = {
enable = true; enable = true;