SWITCH | SWITCHdrive | SWITCHengines |

NixOS image cloud init module


We are using the NixOS images and we find it great that you provide those images!

One thing we noticed is that you enable the “cloud-init-custom” module in the config and we where wondering how that differs from the “cloud-init” module in NixOS? The reason I am asking is because we are using Nixops to deploy our Switch Engines machines and this makes it hard to enable the “cloud-init-custom” packages as we don’t have the nix source derivations for the cloud-init-custom module.

Or is this custom module just needed because the cloud-init version in NixOS is outdated?

Cheers, Philipp

Hi Philipp

The standard cloud-init module doesn’t work (at least it did not when I tried to use it last year to build an image for SWITCHengines). The cloud-init package itself requires a patch and the version of growpart used by the original module doesn’t work either. My customized module also includes a systemd service that waits for the network to be available before cloud-init is started.

The image uses the standard NixOS channel (which is necessary to be able to use nix-channel --update), so the custom stuff needs to be available in the Nix store and pulled in via /etc/configuration.nix (i.e /nix/store/q9n6x4rwskvy86fs3cxyn2dh0gbscjjl-cloud-init-module and /nix/store/qd8ylyvc8gaahivih6zdqslpdxp7y6vf-cloud-init-patch).

You can find the Nix expression that was used to generate the cloud image here: https://github.com/alexandergall/nixos-cloud-image. In particular, the derivation of the custom cloud-init-module is created by simply copying the module to the store: https://github.com/alexandergall/nixos-cloud-image/blob/master/default.nix#L46.

Hope this helps :slight_smile:


Hi Alex

That helps a lot, thank you :slight_smile:
Not sure if all changes/patches should go into NixOS itself, but I assume you don’t mind if I try to get some part into NixOS upstream?


1 Like

Don’t mind at all :slight_smile: It’s been on my to-do list for a long time, but I never got around to doing it properly.

I think the new (17.09) NixOS SWITCHengines images have the standard cloud-init, which now works. Correct?