Elgato 4K60 Capture Card on NixOS
This guide will allow you to use your Elgato 4K60 Capture Card on NixOS through a virtualised copy of Windows.
Prerequisites
- Elgato 4K60 Pro PCI Capture Card.
- Must be in a PCI lane that is grouped separately. Read more here.
- Windows ISO with a version that supports Elgato’s 4K Capture Utility.
Installation
Install the following packages. I use home-manager for this.
spice
spice-gtk
spice-protocol
virt-manager
virt-viewer
win-spice
win-virtio
Set the following settings in your NixOS configuration.
users.users.YourUsernameHere.extraGroups = [ "libvirtd" ];
virtualisation = {
libvirtd = {
enable = true;
qemu = {
swtpm.enable = true;
ovmf.enable = true;
ovmf.packages = with pkgs; [ OVMFFull.fd ];
vhostUserPackages = with pkgs; [ virtiofsd ];
};
};
spiceUSBRedirection.enable = true;
};
services.spice-vdagentd.enable = true;
Finding your Device ID
Obtain the device ID of your capture card using lspci -nn. It will show up as YUAN High-Tech Development Co., Ltd. Device. Make a note of the value at the end, usually something similar to 1234:5678. 
Add the following to your NixOS settings then reboot.
boot.kernelModules = [ "vfio_pci" "vfio" "vfio_iommu_type1" ];
# Replace `12ab:0710` here with the value you got earlier.
boot.kernelParams = [ "intel_iommu=on" "iommu=pt" "vfio-pci.ids=12ab:0710"];
Running the Windows VM
- Make a new Windows VM using
virt-manager. - Add your PCI device by clicking into Add Hardware > PCI Host Device and finding YUAN High-Tech Development Co., Ltd..

- Set up Windows as usual.
- Install Elgato’s 4K Capture Utility software.
From here you should see the input from your capture card. If it doesn’t show up, try unplugging/replugging the HDMI cables on the capture card.