Adding virtio drivers to nixos configuration

I’m trying to create a nixos vm using UTM (which is essentially qemu under the hood). To get clipboard sharing etc working the documentation says I need to install the following drivers

How would I go about adding these to my nixos configuration?

I don’t know about the kernel options, but you probably don’t have to worry about them. As for the drivers, I believe that virgl is enabled by default in mesa.

I haven’t tested this, but to enable clipboard sharing, it should be enough to have:

  # Clipboard sharing
  services.spice-vdagentd.enable = true;

You can also enable the other things from the docs with:

  # Time syncing and scripting
  services.qemuGuest.enable = true;

  # VirtFS alternative for directory sharing
  services.spice-webdavd.enable = true;

Thanks @eljamm, I’ve actually got the following lines in my nixos configuration:

services.spice-vdagentd.enable = true;
services.qemuGuest.enable = true;

and can see that both services are running:

Could it be something else?

I assume you’ve also installed the spice-vdagent package in the guest virtual machine, right?

Edit: This post also has a few suggestions, which might work.

1 Like

Ok that helped.

Just had to install the package seperately to

services.spice-vdagentd.enable = true;

and then start the process manually via spice-vdagent

Thanks for your help