Closed nesteroff closed 1 week ago
This is great. Tested this briefly and worked fine. Let me know what your test results with the other usb devices are!
If you could add ID_INPUT_TOUCHSCREEN
etc. (https://github.com/tiiuae/ghaf/blob/main/packages/hardware-scan/hardware-scan.sh#L242) as well, it would also support touchscreens.
Generally (maybe not as part of this PR) we could use a static configuration file as general policy based on device type and VM, and later add-on user defined passthrough for switcheroo between VMs.
This is great. Tested this briefly and worked fine. Let me know what your test results with the other usb devices are! If you could add
ID_INPUT_TOUCHSCREEN
etc. (https://github.com/tiiuae/ghaf/blob/main/packages/hardware-scan/hardware-scan.sh#L242) as well, it would also support touchscreens.
Thanks. I added touchscreens to the list as well.
Generally (maybe not as part of this PR) we could use a static configuration file as general policy based on device type and VM, and later add-on user defined passthrough for switcheroo between VMs.
Sure. I tried to keep this app simple but in future versions we will need to improve the configuration to implement more complicated rules, add exclusions, support for the cloud hypervisor and so on.
I’ve tested this with input devices, audio headsets, removable disks, and ethernet adapters. It seems to work fine but I left network devices disabled by default because attaching them to the net-vm breaks remote nixos-rebuild with target-host. Also hot-plugging of disk devices is disabled until we have a storage vm or something like that. Do you know if there are any other device types that we need to support?
Perhaps the yubikey and gps devices, so we can get rid of the static external device definition?
Perhaps the yubikey and gps devices, so we can get rid of the static external device definition?
Sure, I'll look into it.
Recent updates:
ghaf.hardware.usb.external
or ghaf.hardware.usb.vhotplug
.Updated to make hot-plugged devices survive suspend and resume.
Tested on Lenovo-X1 (lenovo-x1-carbon-gen11-debug on USB SSD)
No issues found!
Lock
and Log In
screensnixos-rebuild switch
works from host
Description of changes
This adds a service that runs on the host and listens for device add and remove events using libudev. When a new USB device is attached, it is automatically assigned to the designated virtual machine using the official qemu.qmp library."
Checklist for things done
x86_64
aarch64
riscv64
nix flake check --accept-flake-config
and it passesTesting
Input Devices:
Audio Devices:
aplay -l
and find the headset in the list. It should be listed as either card 0 or card 1.speaker-test -D hw:1,0 -c 2 -t sine
. If the headset appears as card 0, change hw:1,0 to hw:0,0.If a bug is found or if something is not working as expected, please collect the vhotplug service logs from journalctl on the host.