45 lines
1.7 KiB
Nix
45 lines
1.7 KiB
Nix
# SD-card image of this host, used exactly once: to bring the board up.
|
|||
|
|
#
|
||
|
|
# Deliberately NOT imported by ./configuration.nix. The flake extends the host
|
||
|
|
# with it (see packages.aarch64-linux.zero2w-sd-image in ../../flake.nix), so
|
||
|
|
# the card carries the host's own kernel, config.txt and SSH keys rather than a
|
||
|
|
# generic installer that then has to be reconfigured over a console this host
|
||
|
|
# does not have -- pppd owns the serial port (./serial-ppp.nix).
|
||
|
|
#
|
||
|
|
# It does not carry the runtime secrets. Seed those into the card's root
|
||
|
|
# partition before first boot; see ../../docs/hosts/pizero2w.md.
|
||
|
|
{
|
||
|
|
config,
|
||
|
|
lib,
|
||
|
|
modulesPath,
|
||
|
|
...
|
||
|
|
}:
|
||
|
|
{
|
||
|
|
imports = [ "${modulesPath}/installer/sd-card/sd-image.nix" ];
|
||
|
|
|
||
|
|
# sd-image.nix pulls in profiles/all-hardware.nix, which is every driver and
|
||
|
|
# firmware blob NixOS knows about. The raspberry-pi-3 profile already carries
|
||
|
|
# what this board has, and the card is small.
|
||
|
|
hardware.enableAllHardware = lib.mkForce false;
|
||
|
|
|
||
|
|
image.baseName = "nixos-zero2w";
|
||
|
|
|
||
|
|
sdImage = {
|
||
|
|
# Compressing costs a long single-threaded pass and buys nothing: the image
|
||
|
|
# is written straight to a card with dd.
|
||
|
|
compressImage = false;
|
||
|
|
|
||
|
|
# The default 30 MiB does not hold the vendor GPU firmware, U-Boot and the
|
||
|
|
# BCM2837 device trees and overlays that nixos-hardware installs here.
|
||
|
|
firmwareSize = 128;
|
||
|
|
|
||
|
|
# The firmware partition is populated by nixos-hardware's firmware module
|
||
|
|
# (it takes over sdImage.populateFirmwareCommands); the root side is the
|
||
|
|
# stock extlinux install, which no longer arrives with it.
|
||
|
|
populateRootCommands = ''
|
||
|
|
mkdir -p ./files/boot
|
||
|
|
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
|
||
|
|
'';
|
||
|
|
};
|
||
|
|
}
|