NixOS on openstack

Hi,

I am trying to run nixos in an openstack nova cluster. I am using nixos-generator to produce an image and push it to the cloud.

  1. has anyone succeeded in doing so?
  2. My understanding is that the SSH key should be stored automagically by the openstack ec2-like endpoint using cloud-init. But … I can only login if I force the ssh key in the image configuration

It’s a bit sad, but I don’t know if the proble comes from the openstack cluster or nixos.

Currently I see a lot of posts about AWS and GCP, unfortunately (or maybe not), these are not the only one out there, and more info for other technologies would be great

1 Like

I have not yet done Openstack with nixOS, though how is your system configuration for the generated image?

Especially the cloud image options?

https://search.nixos.org/options?channel=20.09&show=services.cloud-init.config&from=0&size=30&sort=relevance&query=Services.cloud-init

1 Like

The configuration is quite basic, at the moment it is enabling ssh only,

Then nixos-generator injects the correct profile for openstack to add the metadata magick

Do you have services.cloud-init.enable set? How are the remaining attributes in services.cloud-init?

I really can’t understand what exactly you have done from your last post.

Oh my god … you are right the cloud-init service is not enabled by default, it might solve it…

Now, are there openstack provider without cloud-init ?

The openstack image doesn’t use cloud-init but a shell script using curl instead (mainly to reduce the closure size)!
Once you are logged with your ssh key, do you see any error in the openstack-init systemd service?
Also, are you sure your openstack cloud provides metadata via http and not via a config drive?

Thank you for your comments: now it works !

I suspect a problem with the registered ssh public key, starting all over was good.

Then, I converted my configuration to a flake (flake lover spotted), and it ended up with quite a big update… so I will need to have a closer look to the “channel” used by nixos-generators

Hi @freezeboy, do you mind sharing a repository where you have your source for building the openstack image with cloud-init support.
I am fairly new to nixos, and that is my goal.

Thx

In fact, the nixos-generators project is working correctly, I just use the one from nixos-20.09 as this is my laptop OS.

  1. Then you fill a config file as you would for any system, without bothering with openstack stuff.

  2. You run:

nixos-generate -f openstack configuration.nix
  1. Depending on your internet connection, prepare a coffee, and in the end you get a qcow image.

  2. Upload it using horizon, the openstack cli or terraform

  3. Enjoy

1 Like