Build breaks, but only *without* --keep-failed

Following a recent flake update, a previously-building STM32 firmware package now hits this error:

Assembler messages:
Fatal error: can't create /build/build/foo_firmware/devel/share/foo_firmware/std_periph/misc.o: No such file or directory
make[3]: *** [Makefile:138: /build/build/foo_firmware/devel/share/foo_firmware/std_periph/misc.o] Error 1
make[2]: *** [CMakeFiles/foo_firmware_bootloader.dir/build.make:70: CMakeFiles/foo_firmware_bootloader] Error 2
make[1]: *** [CMakeFiles/Makefile2:955: CMakeFiles/foo_firmware_bootloader.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
Failed   <<< foo_firmware [21.1s, exited with code 2]

In the course of investigating this, though, I discovered that it actually builds just fine with the --keep-failed flag, and of course it’s also fine building manually in a nix develop shell. What are my options for reproducing/understanding this? Are there known failures that happen when building in full isolation vs. with --keep-failed?

And also, is there a better story for diffing before and after a flake update than just doing nix show-derivation or nix path-info -r --derivation on both and diffing the result?

To inspect the build environment without --keep-failed, cntr and breakpointHook might be useful.

Awesome, that’s exactly what I was hoping for!

Looks like somewhat-as-expected, the foo_firmware/devel/share/foo_firmware/lwip/netif path does not exist, so it’s not obvious why that is, but this is a good starting point to investigate further, thanks.