Change:
I'm trying to use USB redirection in gnome-boxes to attach a host device to a VM. When I do that gnome-boxes indicates that USB redirection has failed and I see the following messages in the system log: Start gnome-boxes Start a VM Select "Hamburger Menu" -Properties menu item Select the "Devices and Shares" tab Toggle the redirect control for an available device you can afford to detach from your host to "Yes" Observe error "Redirection of USB device X for VM Y failed." in the interface. Use the command to see the error output above. Output of : I did some digging and tried to solve this myself but get stuck. The immediate problem appeared to be that the required PolicyKit action file isn't available. It appeared to be provided by the . Inspecting the log for the current hydra build of that package seems to show it wasn't being installed into the store path correctly: Notice that the polkit file seems to be installed locally in the build directory instead of into a store path. I tried working around this with the following overlay: which did result in the file being written where I think it should be: What I thought should happen at this point is that the following statement from the NixOS module should cause this file to be linked into when is run: However, this is not happening: I have tried to trace through how the linking is done but I've gotten lost and haven't been able to figure it out. I'd greatly appreciate help!
, mentioning you on this issue since it looks like you made the most recent changes to the package and I'm hoping you might have some context on what is required to fix the problem.
The polkitdir path change was done by me in , for make-based projects, using in the variable is acceptable solution (did the same e.g. in ). The path should be linked correctly with . I if is not, is probably not listed in , maybe we need to add it to ’s .
Thanks for the quick response I did have and I thought I had tried adding directly to and that it hadn't worked. But, I must have done it while there was still some other problem in my override because when I it directly to now the file was symlinked into . Thanks for prompting me to try again. As soon as I have enough time I'll try adding to 's and if that works I'll post a PR with a patch with those changes.
PR is here:
In the NixOS community is the general practice to keep bugs open until the channel updates and they can be verified in the release or just close them once the commit has been merged? I'm fine with either in this case, just want to align what I do with the community.
They're usually closed when the pull request is merged.
Closing since the fix has been merged.
seems this problem is still here. my current setup is unstable and got absolutely the same problem with the same error message in error log
forgot to mention... i'm running on the kernel 5.8. everything else is the default from the unstable channel
i'm still having this issue with virt-manager, i have and virt-manager is installed via home-manager, is that perhaps an issue ?
Yes, you need to install the package through for polkit rules to be picked up. Polkit rules allow you to grant privileged access so installing them through home manager would be insecure. You should use in your NixOS config, which will install polkit rules globally and create a suid helper.

Discussion:
meson ninja vala pkgconfig gettext itstool wrapGAppsHook gobjectIntrospection desktop-file-utils ]; <ins> # Required for USB redirection PolicyKit rules file propagatedUserEnvPkgs = [ spice-gtk ]; </ins> buildInputs = [ libvirt-glib glib gtk3 gtkvnc libxml2 libvirt spice-gtk spice-protocol libsoup json-glib webkitgtk libosinfo systemd

nativeBuildInputs = [ pkgconfig gettext libsoup autoreconfHook vala gobjectIntrospection ]; <del> PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "share/polkit-1/actions"; </del> <ins> PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "$(out)/share/polkit-1/actions"; </ins> configureFlags = [ "--with-gtk3"