A flake.nix which configures an instance of nixos.
The flake uses sops-nix for secrets management, where the secrets are stored in a separate, private, github repo.
I want to deploy this flake with nixos-anywhere (i.e. there is a disko config, etc).
This has so far worked for me very nicely and turned out to be a quite sustainable way to have reoccurring deployments.
My issue is that I need to repeat this for a Raspberry Pi 4B. Getting the image onto the SD card is a bit more of a headache than I would like, but that worked fine. The issues started with the disko config. This is somewhat more complicated than I would like and even discouraged by the maintainer of disko (see this thread here).
Before continuing into this directioin, I thought it might make more sense to just create the correct image, with everything I want so that I can just flash that from the start onto the Pi. Building the image worked fine after some tinkering, but my issue here is that I dont know how to sanely deploy the ssh key needed to decrypt the sops secrets.
So to summarize options and maybe ask questions:
nixos-anywhere + disko: Is this feasible, i.e. has anybody tried it and had success with it?
Build SD Image: Not sure how to get the secrets to decrypt the sops-file to the SD card correctly. Any ideas on how to approach this?
Does the community have any input on which method is preferable?
This means one must boot a nixos installer image, probably from USB which requires a little bit of setup on a Raspberry Pi as I recall, and then using Nixos-Anywhere through that.
Which is all a little awkward, which is why I elected to not bother reinstalling, and keep my existing install based on the prebuilt sdimage.
This is not to say that using Nixos-Anywhere and Disko is not possible, I am pretty sure it is possible, just that I looked into it and elected not to bother.
Regarding the build sdimage sops issue, I think I just used the prebuilt image, login as nixos, update sops config with the autogenerated sshkeys, and rebuild to my config. Pretty manual, but I last did this when my nix skills were up to nothing more interesting.
Yep, that seems exactly right, and is how I recall doing it some months ago. Except my flake is public, and so no ssh key adding to any git provider was required, just use https.
Again, there are almost certainly more elegant solutions requiring less manual work, but that is what I used when I last did this.