Created
September 2, 2024 13:29
-
-
Save bct/28d51ca86c91d3f06f9933cb21f32d32 to your computer and use it in GitHub Desktop.
microvm.nix with USB passthrough
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# declarative microvms do not run as root. in order for USB passthrough to work they need access | |
# to the USB devices in /dev/bus/usb. qemu does not print any kind of error if it does not have | |
# access; the devices just don't show up. | |
# | |
# we can fix this by using udev to grant the "kvm" group access to the USB devices. | |
# in the guest: | |
microvm.devices = [ | |
# RTL2838UHIDIR | |
# Realtek Semiconductor Corp. RTL2838 DVB-T | |
{ bus = "usb"; path = "vendorid=0x0bda,productid=0x2838"; } | |
# Sonoff Zigbee 3.0 USB Dongle Plus | |
# Silicon Labs CP210x UART Bridge | |
{ bus = "usb"; path = "vendorid=0x10c4,productid=0xea60"; } | |
]; | |
# on the host: | |
services.udev.extraRules = '' | |
# RTL2838UHIDIR | |
# Realtek Semiconductor Corp. RTL2838 DVB-T | |
SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="2838", GROUP="kvm" | |
# Sonoff Zigbee 3.0 USB Dongle Plus | |
# Silicon Labs CP210x UART Bridge | |
SUBSYSTEM=="usb", ATTR{idVendor}=="10c4", ATTR{idProduct}=="ea60", GROUP="kvm" | |
''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment