diff --git a/modules/options.nix b/modules/options.nix index c559bba..90577ea 100644 --- a/modules/options.nix +++ b/modules/options.nix @@ -602,6 +602,43 @@ let ''; }; + usbDevices = lib.mkOption { + type = lib.types.listOf ( + lib.types.submodule { + options = { + vendorId = lib.mkOption { + type = lib.types.str; + description = "USB vendor ID (hex, e.g., '17ef')."; + example = "17ef"; + }; + productId = lib.mkOption { + type = lib.types.str; + description = "USB product ID (hex, e.g., '60e0')."; + example = "60e0"; + }; + serial = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + description = "USB serial number to match a specific device. If null, matches all devices with this VID:PID."; + example = "A02019100900"; + }; + }; + } + ); + default = [ ]; + description = '' + USB devices to pass through to this VM. Devices are attached when the VM starts + and detached when it stops. Matched by VID:PID, optionally narrowed by serial number. + If multiple physical devices match a VID:PID (and no serial filter), all are attached. + ''; + example = lib.literalExpression '' + [ + { vendorId = "17ef"; productId = "60e0"; } + { vendorId = "046d"; productId = "c52b"; serial = "A02019100900"; } + ] + ''; + }; + guestPrograms = lib.mkOption { type = lib.types.listOf lib.types.package; default = [ ];