Refactor runner declarations should use the submodule system, to allow for greater flexibility
While experimenting with the newly merged amdgpu native contexts using microvm I've found that microvm is quite inflexible for users who want to modify it's behavior. In this case I found that in order to prevent microvm from setting -nographic I had to set graphics.enable = true, which causes microvm to set -device "virtio-vga-gl", which is incompatible with -device virtio-gpu-gl.
Using the qemu runner as an example, but this would also apply to others.
Instead of the current setup, where the qemu runner declaration is one big function that creates a command from microvm configuration options, it might be sensible to instead have the qemu runner expose a "microvm.qemu.args" option(the same as the existing extraArgs) as well as a readonly command option, with other modules using the option to configure qemu.
This would already allow users to remove any problematic arguments by doing a hack, like:
options.microvm.qemu.args = lib.mkOption { apply = lib.subtractLists [ "-device virtio-vga-gl" ]; };
but the real improvements would be in the ability to further create helper options, like for example microvm.qemu.devices.*, allowing overwriting the options configured for any device.
I'd be up for implementing the changes if @astro would be willing to merge them
I have been contemplating the same idea but I cannot find time to help.
There is one fringe use-case I would like to keep support for: extendModules on a finalized NixOS config with a host-supplied nixpkgs input as done in pkgs/build-microvm.nix. It doesn't have to be API-compatible but it allows more secure provisioning.
This would also allow us to use assertions instead of throws and collect all errors at once and not one after the other.