I’ve been trying to install NixOS on a Raspberry Pi headlessly (no keyboard, no mouse, no monitor, just power, storage and a network connection) for a couple of hours now because I lost my micro HDMI adapter and I realised pretty quickly that I need to build my own ISO to do this properly, so that’s what I’ve been trying to do.
Using this method results in a flashable image but I can’t for the life of me determine if the RPi boots or not, but, in any case, I can’t see it on the router, I can’t ping it, so it likely is not there at all.
Using this method some derivations are having trouble building so I don’t think it’s even my fault. Also I found this one just randomly, I didn’t research it much.
Any help? I’ve been struggling for a while + the hours waiting for stuff to build. I just don’t wanna buy another one of those cursed adapters.
The easiest would probably be to connect a USB keyboard and blindly enter sudo passwd nixos and then any password. After that you should be able to SSH into the pi from your actual machine using ssh nixos@yourmachinehere. This works with the regular NixOS image.
As for building a custom image, you have two options: Cross-compile or compile using emulation.
Many packages are broken in cross compilation but a rather minimal closure should work. Build a minimal image that is only able to accept an SSH connection from your hosts and then do a rebuild into your actual config. Disable anything you don’t need outside of that.
Another option is to build the image natively using emulation. Here you execute aarch64 code on your x86_64 machine using emulation. Though since most derivations will be in the binary cache, you’ll likely only build a few extremely small derivations that barely need any processing power. Simply set boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; on your build machine and make the configuration to be built a native aarch64-linux one.
The method with building the image should work just fine.
When the network port blinks it should be booting.
I haven’t seen where you defined your network config, if you used a static IP it won’t show up on your router.