Running log for the implementation plan. Updated as work proceeds.
✅ Done — boots to bpi-f3 login: on real hardware from the SD card (NixOS 26.11, mainline kernel 7.0.12, rv64gcv). Verified working: serial console, SD root r/w, both Gigabit Ethernet ports (k1_emac/RTL8211F, DHCP), NVMe over PCIe, USB 2.0/3.0, SSH.
Final working configuration:
- U-Boot: Armbian's fork (
pyavitz/spacemit-u-boot@k1-bl-v2.2.9) + its patch set —001adds the raw-offset SPL fallback (OpenSBI→0x500/sector 1280, U-Boot→0x800/sector 2048),002/004add the MMC boot target + extlinux. Banner renamed to "NixOS" viaCONFIG_LOCALVERSION. - OpenSBI: SpacemiT gitee tree, built with
platform-cflags-y=-std=gnu17(GCC 15 / C23). - Image: MBR table, four boot blobs
dd'd at sectors 0/1/1280/2048, first partition at 16 MiB; extlinux boot; kernel cmdline kept under U-Boot's 256-byte cap. - Kernel: nixpkgs
linuxPackages_latest(7.0.12) with forced K1 Kconfig,mmc_blockforce-loaded in initrd, and a DT overlay re-adding the SD-card slot (mmc@d4280000,no-mmc/no-sdio/no-1-8-v/broken-cd/disable-wp) — mainline ships only the eMMC node.
Known minor: the RTC isn't persisted, so the clock relies on NTP at boot (TLS fails until systemd-timesyncd syncs). See the README's Challenges worked around / Limitations.
| # | Step | Status | Notes |
|---|---|---|---|
| 0 | In-repo docs (IMPLEMENTATION.md, PROGRESS.md) |
✅ done | Plan committed in-repo. |
| 1 | Thin flake.nix |
✅ done | nixpkgs + 2 gitee vendor inputs; outputs sdImage/uboot/opensbi. |
| 2 | nix/cross.nix (rv64gcv/lp64d) |
✅ done | |
| 3 | nix/pkgs/opensbi/default.nix |
✅ done | PLATFORM=generic PLATFORM_DEFCONFIG=k1_defconfig → fw_dynamic.itb. |
| 4 | nix/pkgs/u-boot/default.nix |
✅ done | buildUBoot, k1_defconfig + BPI-F3 extraConfig → FSBL.bin/bootinfo_emmc.bin/u-boot.itb. |
| 5 | nix/overlay.nix |
✅ done | Injects vendor srcs from flake inputs. |
| 6 | nix/modules/sd-image/sd-image.nix |
✅ done | Ported from LP4A; switched GPT→MBR (FSBL@sector1 vs GPT header). |
| 7 | nix/modules/sd-image/sd-image-bpi-f3.nix |
✅ done | extlinux + dd blobs at sectors 0/1/1280/2048; 16 MiB gap. |
| 8 | nix/modules/bpi-f3.nix (board module) |
✅ done | linuxPackages_latest + forced K1 Kconfig; deviceTree k1-bananapi-f3.dtb. |
| 9 | nix/modules/user-group.nix |
✅ done | user bpi / pass bpi-f3 (real yescrypt hash). |
| 10 | Rewrite README.md |
✅ done | Build/flash/serial guide + boot-blob offset table. |
| V | Verify: evaluation | ✅ done | nix eval of .#opensbi, .#uboot, .#sdImage drvPaths all succeed. |
| V2 | Verify: full build (compile) | ✅ done | nix build .#sdImage succeeds end-to-end (after the 2 fixes below). 3.15 GiB image. |
| V2a | Verify: on-disk layout | ✅ done | MBR table; part1 FAT32 bootable @16 MiB; part2 ext4. All 4 blobs byte-exact at sectors 0/1/1280/2048; bootinfo magic 0xB00714F0 @0. extlinux.conf + kernel + initrd + k1-bananapi-f3.dtb present. |
| V3 | Verify: hardware bring-up | ✅ done | Boots to bpi-f3 login: on real hardware from SD. Root mounts r/w; both GbE NICs, NVMe/PCIe, USB2/3, SSH all up. |
Legend: ⬜ todo · 🟡 in progress · ✅ done · ⛔ blocked
- 2026-06-14 — Step 0 complete. Plan written to
IMPLEMENTATION.md; this progress doc created. - 2026-06-14 — Steps 1–10 implemented. Key decisions during build:
- Vendor sources pinned via
git+httpsflake inputs (gitee), tagk1-bl-v2.2.10-release(uboot46a4f51…, opensbi34143f5…). Both resolve fine over the network. - Partition table is MBR, not GPT. Armbian's SpacemiT family uses
msdos; GPT's primary header at LBA1 would be clobbered byFSBL.bin(dd'd to sector 1).bootinfo_emmc.bin(~80 B) coexists with the MBR table at byte offset 446. - Bootloader blobs dd'd in
postBuildCommandsat sectors 0/1/1280/2048 (mirrors armbian'swrite_uboot_platform). 16 MiB firmware-partition gap clears them. - Kernel:
linuxPackages_latest(nixpkgs unstable = 7.0.12) with K1 Kconfig forced on (ARCH_SPACEMIT,SPACEMIT_K1_CCU,PINCTRL/GPIO_SPACEMIT_K1,MMC_SDHCI_OF_K1,SERIAL_8250_DW,SPACEMIT_K1_EMAC). Symbols verified against mainline riscv defconfig.
- Vendor sources pinned via
- 2026-06-14 — Verification: fixed
extraStructuredConfig→structuredExtraConfig(nixpkgs rename) in the kernelPatches entry, caught by evaluation. All flake inputs resolve and.#opensbi,.#uboot,.#sdImageevaluate to derivations successfully. - Next: run the full
nix build .#sdImageon the fast host (expect a long first build — no cache hits atrv64gcv), then flash and bring up on hardware. Watch the vendor U-Boot build (python signing/bootinfo tooling) — the documented fallback is prebuilt blobs if it fights. - 2026-06-14 — First
nix build .#sdImage(--keep-going) run. Cross toolchain (GCC 15.2.0 for rv64gcv) + binutils/glibc built fine. OpenSBI build failed: vendor tree hastypedef int bool;insbi_types.h; GCC 15 defaults to-std=c23(whereboolis a keyword), fatal under-Werror. Fix applied: addedplatform-cflags-y=-std=gnu17to the opensbi makeFlags (folded into global CFLAGS, so it covers lib/sbi). Same pattern as the LP4A opensbi. Letting the--keep-goingrun continue to also exercise the U-Boot + kernel builds before re-running with the fix. - 2026-06-14/15 — ✅ Vendor U-Boot built cleanly from source — the highest-risk derivation. The SPL compiled, the Python tooling (
build_binary_file.py) ran without error and emitted FSBL + all bootinfo images, and the FIT (u-boot.itb) assembled. Output verified:bootinfo_emmc.bin= 80 bytes (confirms it fits before the MBR table at byte 446 — the empirical basis for the GPT→MBR decision),FSBL.bin= 210,592 B (sector 1 → ~412, clear of OpenSBI @1280),u-boot.itb= 2,043,686 B (sector 2048 → ~6040, well within the 16 MiB gap). No overlaps; the offset layout is validated. The from-source bootloader approach works — the prebuilt-blob fallback is not needed.
- 2026-06-15 — Second failure surfaced near the end of the first run:
eflfailed to cross-compile (eolian_genbuild tool not found for riscv64), cascading up throughfastfetch→system-path→ the image.fastfetch(cosmetic, headless-irrelevant) was pulling the entireeflGUI toolkit. Fix: removedfastfetchfromenvironment.systemPackages. The kernel (linux-7.0.3/7.0.12) + initrd had already built fine with the forced K1 config. - 2026-06-15 — ✅ Full build succeeds. Re-ran
nix build .#sdImagewith both fixes (OpenSBI-std=gnu17, fastfetch removed); everything else cached. Produced a 3.15 GiB image. Verified:- partition table = MBR (
dos), id 0x2178694e; part1 FAT32 bootable @ sector 32768 (16 MiB), part2 ext4; - all four bootloader blobs
cmp-identical to the package outputs at sectors 0/1/1280/2048; bootinfo magic0xB00714F0at offset 0; - FAT boot partition holds
extlinux.conf(correct serial-console cmdline), the kernel Image, initrd, andspacemit/k1-bananapi-f3.dtb(referenced viaFDT). Software build + image layout fully validated. Only on-hardware boot (V3) remains.
- partition table = MBR (
- 2026-06-15 — First hardware boot attempt: card verified good on the device (
xxd /dev/sdbshows bootinfo magicf014 07b0; MBR table; correct partitions), DIP switches at default (SD tried first), minicom 115200 8N1 flow-control off — but only a brief garbled UART burst then silence. Root-caused from the U-Boot source:common/spl/spl_mmc.c(vanilla vendor U-Boot, which we built) loads OpenSBI/U-Boot only from GPT partitions named "opensbi"/"uboot" — it does NOT read raw sector offsets. Our MBR + raw offsets meant the SPL/FSBL ran, found neither partition, and hung → exactly the symptom.- Armbian's raw-offset scheme works only because of its
001-MBR-support.patch, which hardcodes the fallbackopensbi -> 0x500 (sector 1280),uboot -> 0x800 (sector 2048)— the exact offsets we already dd to. We'd built vanilla vendor U-Boot without that patch. - Additionally, vanilla
BOOT_TARGET_DEVICESlists only QEMU and boots via bespoke env scripts (loadknl/loaddtb+ EEPROM DTB detection), not extlinux — so it would never read ourextlinux.confeven with001. Armbian's002(mmc boot target + kernel/fdt/ramdisk load addrs) and004(syslinux/extlinux) fix that. - Fix: switch the U-Boot input to Armbian's exact source (
pyavitz/spacemit-u-boot@k1-bl-v2.2.9-release) and apply Armbian's patch set (001,002,003,004,007,008,009; 005/006 are OrangePi-only), vendored undernix/pkgs/u-boot/patches/. The MBR + raw-offset image layout is unchanged (it already matches the patch's 0x500/0x800 fallback). OpenSBI kept as-is (it builds and is loaded by offset). Rebuilding U-Boot + image; reflash + retest pending.
- 2026-06-15 — Patched U-Boot built cleanly (GCC 15, no issues on the pyavitz tree; all 7 patches applied). Rebuilt the image; new
u-boot.itbis 2,379,974 B (vs 2.0 MB before) and verified at sector 2048; MBR + partitions unchanged. Awaiting reflash + serial capture. With001'sBPI:/K1X:SPL debug prints enabled, even a partial boot should now narrate how far the SPL gets. - 2026-06-15 — Reflashed patched image. It boots! Serial captured cleanly via
stty 115200 raw+cat/picocom -b 115200(the earlier "garble" was minicom not actually applying 115200 — 115200 is correct). Boot chain observed:try sd... -> U-Boot SPL 2022.10 Armbian -> DDR LPDDR4X 2400MT/s -> loads fit (opensbi+uboot) -> U-Boot 2022.10 (Model: spacemit k1-x deb1, DRAM 8192 MB) -> MMC/PCIe(Gen2-x2)/eth -> Retrieving /extlinux/extlinux.conf -> NixOS menu -> loads initrd + kernel Image 7.0.12. (Aside: "8 GB" on the label is the RAM, which trained fine — not eMMC.) Then it stalls:bootarg overflow 262+0+0+1 > 256— the vendor U-Boot caps the kernel cmdline at 256 bytes and our APPEND (longinit=/nix/store/...+ root=fstab/loglevel/lsm + our params) was 262. Falls through to NVMe (absent) ->=>prompt. Fix: trimmedboot.kernelParams(droppedconsole=tty1,root=UUID=,rootfstype=ext4— redundant since the initrd mounts root by the NIXOS_SD label) to get well under 256. Rebuilding image; reflash + retest pending. (Future hardening: raise the U-Boot 256-byte bootargs cap so long cmdlines can't regress this.) - 2026-06-15 — Trimmed-cmdline image (APPEND now 186 B) boots into the kernel + initrd! extlinux hands off, kernel + systemd-initrd come up. New stall: initrd times out on
/dev/disk/by-label/NIXOS_SD→ emergency mode (and the locked emergency console blocked debugging). Checked the built kernel config: K1 host drivers are builtin (MMC_SDHCI_OF_K1=y,SPACEMIT_K1_CCU=y, pinctrl/gpio =y) butMMC_BLOCK=m— the block layer that creates/dev/mmcblk*is a module and udev didn't autoload it in the initrd, so no block device → no root. Fix (no kernel rebuild):boot.initrd.kernelModules = [ "mmc_block" ]to force-load it; plusboot.initrd.systemd.emergencyAccess = trueandboot.consoleLogLevel = 7so any further failure drops to a usable root shell withdmesg. Rebuilding initrd + image; reflash + retest pending. - 2026-06-15 —
mmc_blockforce-load worked (eMMCmmcblk0now enumerates, emergency shell now accessible) but root still not found. Emergency-shellcat /proc/partitionsshows ONLYmmcblk0(+boot0/boot1/rpmb = eMMC, ~29 GiB) — no SD-card block device, no /dev/disk/by-label. Decompiled the shippedk1-bananapi-f3.dtb: it has onlymmc@d4281000(eMMC); the SD-card slot controllermmc@d4280000(SDH0) is absent from the mainline DTS (true in 7.0.12 and the 7.1 tree —k1.dtsidefines onlyemmc). So mainline supports K1 eMMC but not the BPI-F3 removable SD slot; U-Boot reads SD via its own DTB, but the kernel has no node to bind. Root cause of root timeout. User chose: re-add the SD slot via a DT overlay. Fix:hardware.deviceTree.overlaysaddsmmc@d4280000under/soc/storage-bus, mirroring the working eMMC node (spacemit,k1-sdhci) but with SDH0 clocks/resets (CLK_SDH0/RESET_SDH0fromspacemit,k1-syscon.h), IRQ 99,bus-width=4,broken-cd. No pinctrl/regulator yet (eMMC works without them; U-Boot already powered/muxed the slot) — add if the card still isn't detected. Rebuilding DTB+image (no kernel rebuild); reflash + retest pending. - 2026-06-16 — Overlay didn't apply at first: NixOS
apply_overlays.pyskips an overlay whose rootcompatibledoesn't intersect the base DTB's. Fix: addedcompatible = "bananapi,bpi-f3", "spacemit,k1";to the overlay root. Verified the rebuilt DTB now has bothmmc@d4280000(SD, status okay) andmmc@d4281000(eMMC, status okay). Built full image; reflash + retest pending — expecting the SD card to enumerate and root to mount. - 2026-06-16 — Overlay applied, but the kernel panicked in
spacemit_sdhci_set_uhs_signaling(load access fault readingSDHCI_HOST_CONTROL2@0x3E). ThatVDD_180write only runs when the node is NOTno-sdio; the eMMC node setsno-sd/no-sdioand skips it. Fix: mark the SD slotno-mmc; no-sdio; no-1-8-v;(correct for an SD-card slot, and avoids the faulting path). (Also:#comments in the overlay broke the cpp/dtc parse — DTS comments must be//.) - 2026-06-16 — SD card then enumerated (
mmc0: new high speed SDXC card,mmcblk0 119 GiB,NIXOS_SDfound, ext4 mounted) but read-only →/sysroot/runfailed → emergency. The microSD slot has no write-protect tab but the controller's WP sense reads "protected". Fix:disable-wp;. - 2026-06-16 — ✅✅ FULL BOOT. Reflashed; NixOS boots to
bpi-f3 login:on hardware. Root mounts r/w, switch-root + first-boot activation succeed. Working: both GbE (k1_emac, RTL8211F), NVMe over PCIe, USB2/3 hubs, SSH daemon. Loginbpi/bpi-f3. Cleanup:CONFIG_LOCALVERSION=" NixOS"(U-Boot banner now reads "NixOS" not "Armbian"); removed theinitcall_debug/consoleLogLevel=7debug params (kept the workingearlycon=uart8250+ the SD overlay +mmc_blockforce-load +emergencyAccess). - 2026-06-16 — Root-on-NVMe support (the SD card chokes under build I/O —
mmc_rescanhung-task warnings duringnix-shell/kernel builds; the 931 GB NVMe is the fix). Boot stays on SD (BootROM can't read PCIe/NVMe); only/+ the Nix store move. On-device probe confirmed the K1 PCIe stack is already builtin (PCIE_SPACEMIT_K1=y,PHY_SPACEMIT_K1_PCIE=y,PCIE_DW_HOST=y) and onlyBLK_DEV_NVME=m— so the single kernel change is addingnvmetoboot.initrd.availableKernelModules(no kernel rebuild; udev autoloads it once the builtin controller enumerates the bus). AddednixosConfigurations.bpi-f3-nvme(/onby-label/NIXOS_NVME,nix/modules/nvme/root.nix) whose toplevel is shipped inside the SD image, plusbpi-f3-nvme-install(a wipe-guardedwriteShellApplicationthat partitions/formats the NVMe,rsync-clones the running system, and repoints the SD boot config via the extlinuxpopulateCmd) and a first-boot service that auto-migrates only when the NVMe is blank (nix/modules/nvme/provision.nix, opt-out viabpi-f3.nvme.autoInstall). Gotcha solved:root.nixmust restate the wholefileSystemsset atmkOverride 40— sd-image-bpi-f3.nix declares it withmkForce(50) and override-filtering resolves the option as a unit, so a nested-leaf override at default priority gets dropped wholesale.nix flake checkpasses (both configs eval; installer script shellcheck-clean). Cross build + on-hardware migration bring-up in the next entry. - 2026-06-18 — ✅✅ Root-on-NVMe verified on hardware — fresh flash auto-detects the blank NVMe, migrates, reboots, and comes up with
/onnvme0n1p1(916 G), fully hands-off. Bring-up surfaced a chain of fixes, all landed:- Auto-install raced the NVMe probe. The first-boot unit used
ConditionPathExists=/dev/nvme0n1, but the NVMe enumerates asynchronously over PCIe — the node didn't exist yet, so systemd silently skipped the unit. Fix: drop the condition; poll for the device in-script (≈30 s). /boot/firmwaremountpoint didn't exist on the running system (it'snoauto, and the image build populates that FAT partition out-of-band), so the boot-repointmountfailed. Fix:mkdir -pbefore mounting.- SD controller IRQ storm under migration I/O. The hand-added SD slot raises a spurious SDHCI vendor interrupt (
0x01000000) the generic driver doesn't ack; under the rsync load the kernel hitirq N: nobody caredand disabled the SD IRQ, killing the controller mid-transfer → I/O errors → aborted ext4 journal (looked like a dying card / fs corruption, but was neither). Fix:irqpoll(the kernel's own suggestion), scoped to the SD-boot system only vianvme/provision.nix(the migrated NVMe system doesn't carry the perf cost). - extlinux populate quoting bug.
BOOT_POPULATEholds the builder plus its-g/-t/-nflags; quoting it as one token gave "No such file or directory". Fix:read -rainto argv. - Cross-compile gotcha (the subtle one).
generic-extlinux-compatible.populateCmdis deliberately built againstpkgs.buildPackages(x86_64) for image-build time — running it on the board threw "Exec format error" on every coreutils call. Fix: rebuild the extlinux-conf-builder againstpkgs(riscv64) — the same nativebuilderNixOS uses for on-device activation — and reconstruct its args (nvme/provision.nix:bootPopulate). - Reboot sometimes hangs at
reboot: Restarting system(SBI/PSCI reset not fully wired in the vendor OpenSBI/DT — green→red LED, no cold restart); a power-cycle always works, and it cold-rebooted cleanly once the SD was healthy. Left as a known quirk for now. - Post-migration SD dropout. On the NVMe system (no
irqpoll) the SD enumerated thenmmc0: card 5048 removedat ~32 s (software card-detect polling on the unreliable CD line). Fix:non-removableinsd-overlay.dts(forces present, disables removal polling) so the SD stays put — needed because/boot/firmwarelives on it. - On-device rebuilds now update boot. NVMe system installs its bootloader to
/boot/firmware(mirroredBoots) and auto-mounts it (nofail, nonoauto), sonixos-rebuildupdates what U-Boot reads — no reflash needed for kernel work. - NVMe swap for build headroom: a
writeShellApplicationservice sizes/swapfiletoMemTotalat boot (runtime, not baked — adapts to 4/8/16 GB board variants). Addedbpi-f3-nvme-wipe(guarded, defaults to abort) to reset the NVMe for clean re-tests.
- Auto-install raced the NVMe probe. The first-boot unit used
- 2026-06-16 — Nix refactor for maintainer-grade quality (pure refactor —
nix evalof.#sdImage/.#uboot/.#opensbidrvPaths identical before/after, image unchanged). Convertedflake.nixto flake-parts + treefmt-nix; built the cross pkgset once and injected vianixpkgs.pkgs(removed the duplicated overlay/crossSystem). Split the oldbpi-f3.nixintokernel.nix/hardware.nix/base.nixunder amodules/default.nixaggregator, and extracted the DT overlay tosd-overlay.dts(viabuiltins.readFile, byte-identical). Addednix fmt(nixfmt-rfc-style + deadnix),nix flake check(treefmt + statix), and anix developshell; tidied packagemeta; grouped repeated attr keys per statix.nix flake checkpasses clean. - 2026-06-22 — Diagnosed a scary-looking "SD card failure" as a transient controller wedge, not media. A brand-new high-quality ("gold") SanDisk card showed the same
mmcblk0I/O-error storm at ~31 s as the old card —EXT4-fs error/Aborting journal/ mass service failure — so it was never the card. Live diagnosis over the serial console (driven from laptopt) on the running box showed the truth: the SD recovered (root stayed mounted rw, binaries kept exec'ing),/proc/interruptsshowed the SD IRQ (mmc0, PLIC 99) still live, anddmesghad zero errors minutes later. The storm is a transient wedge of the hand-added SD-slot controller under the dense multi-user startup burst (dhcpcd + lldpd + sshd-keygen + NVMe PCIe probe + nvme-autoinstall all firing at once);irqpollkeeps the IRQ from being permanently disabled, so it self-heals. The throttled migration rsync (--bwlimit=8M) then completed through it and the board rebooted onto the NVMe system (root/dev/nvme0n1p1,/swapfile7.7 G sized to RAM, ssh + getty + lldpd + logind + dhcp all up, 0 SD errors) —rebootnow cold-resets cleanly (the P1 PMIC reboot-cell patch). Net: the auto-migration self-heals through the wedge; root-on-NVMe is the healthy steady state (SD only carries/boot/firmware). Possible future hardening if a fresh migration ever fails outright: stagger the autoinstall off the startup burst (order it after network-online + a short settle), holdlldpd/dhcpcduntil after migration, or drop the SD clock to 12.5 MHz for the SD-root boot. - 2026-06-22 — Fresh re-run reproduced the severe wedge, then hardened against it. Wiped the NVMe (
bpi-f3-nvme-wipe) and rebooted the sd-root entry to watch the auto-install run on a blank NVMe from scratch. It hit the bad-luck path: at ~31 s the SD took a WRITE I/O error, the ext4 journal aborted, and the auto-install died trying to execsleepoff the wedged SD (/bin/sleep: Input/output error) → migration never ran and the box hung (needed a power-cycle). So the migration was a coin-flip on this marginal slot. Combined hardening landed (one reflash): (1) SD clock 25 → 12.5 MHz (sd-overlay.dts) for more signal-integrity margin — 25 MHz still wedged on the gold card; (2) quiet the first-boot burst — orderlldpd/dhcpcd/sshdafterbpi-f3-nvme-autoinstallso they don't hammer the SD during the migration (none is needed for it — the clone is entirely local), innvme/provision.nix; (3) resilient migrator — the whole partition→format→ rsync→boot-repoint sequence is now an idempotentmigrate()wrapped in a retry-up-to-3 loop with explicit per-step checks, the--autocountdown tolerates a failedsleep, andsfdiskis fed viaprintf|instead of a heredoc. Rebuild + reflash + re-test pending. - 2026-06-23 — Root cause was never the SD timing — it was an unregistered Nix store, and the SD wedge only ever exposed it. Reflashed with the hardening above and watched a fresh blank-NVMe boot: the 12.5 MHz + deferred services worked — no SD wedge at all, clean boot, auto-install partitioned/ formatted/rsync'd cleanly. But every migration attempt then failed deterministically at
nix-env --setwitherror: path '…d9lsrb304…-nixos- system-bpi-f3' is required, but there is no substituter that can build it(the retry loop dutifully retried 3× — uselessly, since it wasn't transient). Diagnosed live over serial: the NVMe-root toplevel was present on disk but unregistered (nix path-info→ invalid), and so was/run/current-system;/nix-path-registrationwas still present (313 KB, containedd9lsrb304). The sd-image first-bootpostBootCommands(sd-image/sd-image.nix) ran the partition resize (sfdisk/resize2fs) beforenix-store --load-db, all under oneset -euo pipefail— so when the early-boot resize aborted, the DB load was skipped and the entire store was left unregistered, which only surfaced much later as the migration'snix-env --setfailure. This is what made the whole thing look like a flaky-SD coin-flip: registration ran (and the migration worked) only when the early resize happened to succeed. Fix: reorderpostBootCommandstoload-db+ profile//etc/NIXOSfirst (correctness), then do the resize best-effort (anif/elseso a resize failure can't abort the block). Verified the theory on the live board: a manualnix-store --load-db < /nix-path-registrationmade the toplevel valid and a re-runbpi-f3-nvme-install --yes --rebootmigrated cleanly. Image rebuilt with the fix; clean-flash auto-path re-test pending. - 2026-06-23 — ✅✅ Clean-flash, fully-automatic path verified end-to-end. Reflashed the registration-fix image and confirmed on the live board: the fixed
postBootCommandsnow registers the store on first boot (/run/current-system→ valid,/nix-path-registrationremoved) and no SD wedge (12.5 MHz + deferred services). Wiped the NVMe, rebooted, and the auto-install ran hands-off on the blank NVMe — blank detected → partition → format → rsync →nix-env --set(succeeded first try, no retries) → boot-repoint → "Migration complete" → reboot into the NVMe system. Final state:/onnvme0n1p1,/swapfile7.7 G, store registered, 0 I/O/ext4/IRQ errors. Known cost: at 12.5 MHz the one-time migration rsync of/nix/store(many small files) is slower (~11 min vs ~6). If a board proves stable, 25 MHz + the deferred-services quieting may suffice now that the registration bug (the real culprit) is fixed — worth revisiting, but 12.5 MHz is the safe default.