nix-community / nixos-anywhere

install nixos everywhere via ssh [maintainer=@numtide]
https://nix-community.github.io/nixos-anywhere/
MIT License
1.63k stars 114 forks source link

Support for cloudinit metadata #4

Open zimbatm opened 1 year ago

zimbatm commented 1 year ago

Is your feature request related to a problem? Please describe.

When provisioning a new system, we might want to provide metadata to configure things like the machine's hostname, authorized SSH keys, .... But not all targets have a metadata service (eg: a Hetzner machine doesn't provide the metadata).

Describe the solution you'd like

Cloudinit can source some of its metadata from a specially crafted disk partition. nixos-remote could be used to prepare that disk partition.

See https://cloudinit.readthedocs.io/en/latest/topics/datasources/configdrive.html

Describe alternatives you've considered

Additional context

phaer commented 1 year ago

a Hetzner machine doesn't provide the metadata

Just in case this isn't known already: dedicated hetzner machines do not, but for hetzner cloud machines there's http://169.254.169.254/hetzner/v1/metadata providing metadata.

jh-devv commented 7 months ago

+1

I emailed Numtide about this a while ago.

But I'd say this would be an idea for an new project?

Would make deploying a lot of machines hell'a easier.

Basically the idea would be:

Build an bare NixOS iso with CloudInit ➞ Boot an bare minimal NixOS iso with CloudInit ➞ Pass these values to Nix (nixos-anywhere or nixos-install) ➞ Reboot ➞ Profit?

Providing a template flake could be Amal beneficial?

jh-devv commented 7 months ago

Currently, maybe something like this could for at least me: https://gist.github.com/voidus/1230b200043b7f815e2513663d16353b

Though, I could make a flake to make this easier