I’m starting a new project that will have a fair bit of system configuration wrangling involved, and I’d like to define my configuration declaratively, but it seems like I need to be running Linux to build a Linux image.
Basically, I’d like to offer two things: a lowered barrier to entry for contributors by having a straightforward way to start up a development environment locally (without necessarily running NixOS themselves), and a way to generate VM images for deployment in an OpenStack cloud. I can see that there are tools for this, but I can’t seem to make them work on macOS.
First, I tried to use https://github.com/nix-community/vagrant-nixos-plugin but it appears nixos - Vagrant Cloud is more or less abandoned.
Second, I saw https://github.com/NixOS/docker and thought I could use it with GitHub - nix-community/nixos-generators: Collection of image builders [maintainer=@Lassulus] and canned Linux VM I’m already running for Docker on macOS. However, my attempt to generate a VM image from within a VM … didn’t work.
ex.nix:
{pkgs, ...}:
{
services.nginx.enable = true;
}
nixos-generate -f openstack -c ex.nix
downloaded a bunch of stuff, but failed with
error: a 'x86_64-linux' with features {kvm} is required to build '/nix/store/3v45gv7y68zlba2lagj4awpk7hdrvm5p-nixos-disk-image.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, nixos-test}
after some digging, I found https://github.com/nix-community/nixbox/issues/38#issuecomment-583354822 which tells me kvm is required to build an image.
So… what do I do? The prospect of resorting to Ansible “scripts” in YAML fills me with dread. On the other hand, I can’t very well ask every contributor to switch to NixOS. I could try Vagrant with something like https://github.com/elitak/nixos-infect but that seems… risky.
Is there an option I haven’t tried?