I want to build an Raspberry Pi image, build on my workstation so I can just dd it to an SD card.
There seem to be several guides on how to do that. But: I need the entire SD card read-only because the RasPi can loose power at any time.
In the past I’ve done that with a script like this. And now I’d like to do this with NixOS. I read about impermanence but I can’t manage to combine the concepts. Is there anyone who did something like that and wrote some blog article that I didn’t find? Is Impermanence the correct concept to do something like this?
And a bonus question: What’s the current situation with binary caching and the armv7 architecture? Is there still nothing out there? I’d try and tinker around until I find a solution on my own, but building images takes so much resources…
Regarding the cache I’ve had better experience using aarch64 instead of armv7.
While my project is currently in the fridge, I’ve collected some raspberry pi related links that might be relevant to you. Unfortunately nothing in there directly answers your question.
I took down my dotfiles for security reasons and mild paranoia. Ill post a up to date version just for you. (Though be warned i dont consider my dotfiles anywhere near “best practices”)
That’s essentially what I do for my own Rasperry Pis running NixOS. I’m using a small FAT32 boot partition containing the required firmware, and a larger btrfs root partition containing subvolumes for/nix and /persist. (Strictly speaking, my setup isn’t read-only because I still wanna do automatic upgrades, but it wouldn’t be an issue to mount /nix and /boot with ro.