astro / microvm.nix

NixOS MicroVMs
https://astro.github.io/microvm.nix/
MIT License
1.38k stars 101 forks source link

Pass additional NixOS modules to VM #197

Closed pizzapim closed 9 months ago

pizzapim commented 9 months ago

I use custom NixOS modules to make additional NixOS options available to my servers, and I would like to do the same for VMs. However, I could not find a way to do this. I am using the fully declarative MicroVM setup.

An option like the following would be awesome:

{ microvm, ... }: {
  imports = [ microvm.host ];
  microvm.vms = {
    my-microvm = {

      extraModules = [ ];

      config = {
        # [...]
      };
    };
  };
}
astro commented 9 months ago

NixOS modules are equivalent to NixOS configurations. Just add an imports = [ ... ] configuration to your NixOS.