Release NixOS 23.11
[NixPkgs.git] / nixos / modules / virtualisation / spice-usb-redirection.nix
blobab2b058c686f7f61ca095f6563a91a054b717f78
1 { config, pkgs, lib, ... }:
3   options.virtualisation.spiceUSBRedirection.enable = lib.mkOption {
4     type = lib.types.bool;
5     default = false;
6     description = lib.mdDoc ''
7       Install the SPICE USB redirection helper with setuid
8       privileges. This allows unprivileged users to pass USB devices
9       connected to this machine to libvirt VMs, both local and
10       remote. Note that this allows users arbitrary access to USB
11       devices.
12     '';
13   };
15   config = lib.mkIf config.virtualisation.spiceUSBRedirection.enable {
16     environment.systemPackages = [ pkgs.spice-gtk ]; # For polkit actions
17     security.wrappers.spice-client-glib-usb-acl-helper = {
18       owner = "root";
19       group = "root";
20       capabilities = "cap_fowner+ep";
21       source = "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
22     };
23   };
25   meta.maintainers = [ lib.maintainers.lheckemann ];