A cloudinit image for use in proxmox

Hey folks,

I’ve spent the last few nights fiddling with this and thought I’d share it in case someone else needs it.

Basically, I want to use nixos in our proxmox cluster. We’re used to provisioning VMs with terraform and cloudinit, but proxmox makes it a little difficult to use the cloudinit runcmd tthat’s the obvious path for nixos-infect.
Besides that, I don’t know when to stop, so I thought “Why even use the debian cloudinit vm, that seems like unnecessary extra steps” - so I built a nixos cloudinit VM.

A lot of the modules don’t make a whole lot of sense, so I removed them. The only thing we’re really doing is adding ssh keys to the predefined user and setting a static IP and gateway, so most other parts are disabled.
You’d push a nixos config that doesn’t have cloudinit on it anyways I guess.

The flake is under a hundred lines :smiling_face_with_three_hearts:

It’s somewhat opinionated though, so read through it before using it, but if you’re in this deep I assume you’d do that anyways.

Hello @voydus

Thanks a lot for sharing. I’m trying to run this flake and it stops up with multiple errors.

error: flake 'path:/home/ops/pm-cloud-init' does not provide attribute 'apps.x86_64-linux.default', 'defaultApp.x86_64-linux', 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux'

I’m new to nixos and I’m probably missing something obvious. Could you please help?

Thanks

Hi, thanks for sharing.

@mrborkander to build the image you need to run nix build .#image (or set a path if you are not in the directory of flake.nix)