@@ -14,117 +14,120 @@ let
1414 types
1515 mkIf
1616 literalExpression
17+ optionals
1718 ;
1819
19- defaultRules = [
20- {
21- name = "GUIVM" ;
22- qmpSocket = "/var/lib/microvms/gui-vm/gui-vm.sock" ;
23- usbPassthrough = [
24- {
25- class = 3 ;
26- protocol = 1 ;
27- description = "HID Keyboard" ;
28- }
29- {
30- class = 3 ;
31- protocol = 2 ;
32- description = "HID Mouse" ;
33- }
34- {
35- class = 11 ;
36- description = "Chip/SmartCard (e.g. YubiKey)" ;
37- }
38- {
39- class = 224 ;
40- subclass = 1 ;
41- protocol = 1 ;
42- description = "Bluetooth" ;
43- disable = true ;
44- }
45- {
46- class = 8 ;
47- subclass = 6 ;
48- description = "Mass Storage - SCSI (USB drives)" ;
49- }
50- {
51- class = 17 ;
52- description = "USB-C alternate modes supported by device" ;
53- }
54- ] ;
55- evdevPassthrough = {
56- enable = cfg . enableEvdevPassthrough ;
57- inherit ( cfg ) pcieBusPrefix ;
58- } ;
59- }
60- {
61- name = "NetVM" ;
62- qmpSocket = "/var/lib/microvms/net-vm/net-vm.sock" ;
63- usbPassthrough = [
64- {
65- class = 2 ;
66- subclass = 6 ;
67- description = "Communications - Ethernet Networking" ;
68- }
69- {
70- vendorId = "0b95" ;
71- productId = "1790" ;
72- description = "ASIX Elec. Corp. AX88179 UE306 Ethernet Adapter" ;
73- }
74- ] ;
75- }
76-
77- {
78- name = "ChromeVM" ;
79- qmpSocket = "/var/lib/microvms/chrome-vm/chrome-vm.sock" ;
80- usbPassthrough = [
81- {
82- class = 14 ;
83- description = "Video (USB Webcams)" ;
84- ignore = [
85- {
86- # Ignore Lenovo X1 camera since it is attached to the business-vm
87- # Finland SKU
88- vendorId = "04f2" ;
89- productId = "b751" ;
90- description = "Lenovo X1 Integrated Camera" ;
91- }
92- {
93- # Ignore Lenovo X1 camera since it is attached to the business-vm
94- # Uae 1st SKU
95- vendorId = "5986" ;
96- productId = "2145" ;
97- description = "Lenovo X1 Integrated Camera" ;
98- }
99- {
100- # Ignore Lenovo X1 camera since it is attached to the business-vm
101- # UAE #2 SKU
102- vendorId = "30c9" ;
103- productId = "0052" ;
104- description = "Lenovo X1 Integrated Camera" ;
105- }
106- {
107- # Ignore Lenovo X1 gen 12 camera since it is attached to the business-vm
108- # Finland SKU
109- vendorId = "30c9" ;
110- productId = "005f" ;
111- description = "Lenovo X1 Integrated Camera" ;
112- }
113- ] ;
114- }
115- ] ;
116- }
117- {
118- name = "AudioVM" ;
119- qmpSocket = "/var/lib/microvms/audio-vm/audio-vm.sock" ;
120- usbPassthrough = [
121- {
122- class = 1 ;
123- description = "Audio" ;
124- }
125- ] ;
126- }
127- ] ;
20+ defaultRules =
21+ [
22+ {
23+ name = "GUIVM" ;
24+ qmpSocket = "/var/lib/microvms/gui-vm/gui-vm.sock" ;
25+ usbPassthrough = [
26+ {
27+ class = 3 ;
28+ protocol = 1 ;
29+ description = "HID Keyboard" ;
30+ }
31+ {
32+ class = 3 ;
33+ protocol = 2 ;
34+ description = "HID Mouse" ;
35+ }
36+ {
37+ class = 11 ;
38+ description = "Chip/SmartCard (e.g. YubiKey)" ;
39+ }
40+ {
41+ class = 224 ;
42+ subclass = 1 ;
43+ protocol = 1 ;
44+ description = "Bluetooth" ;
45+ disable = true ;
46+ }
47+ {
48+ class = 8 ;
49+ subclass = 6 ;
50+ description = "Mass Storage - SCSI (USB drives)" ;
51+ }
52+ {
53+ class = 17 ;
54+ description = "USB-C alternate modes supported by device" ;
55+ }
56+ ] ;
57+ evdevPassthrough = {
58+ enable = cfg . enableEvdevPassthrough ;
59+ inherit ( cfg ) pcieBusPrefix ;
60+ } ;
61+ }
62+ {
63+ name = "NetVM" ;
64+ qmpSocket = "/var/lib/microvms/net-vm/net-vm.sock" ;
65+ usbPassthrough = [
66+ {
67+ class = 2 ;
68+ subclass = 6 ;
69+ description = "Communications - Ethernet Networking" ;
70+ }
71+ {
72+ vendorId = "0b95" ;
73+ productId = "1790" ;
74+ description = "ASIX Elec. Corp. AX88179 UE306 Ethernet Adapter" ;
75+ }
76+ ] ;
77+ }
78+ {
79+ name = "AudioVM" ;
80+ qmpSocket = "/var/lib/microvms/audio-vm/audio-vm.sock" ;
81+ usbPassthrough = [
82+ {
83+ class = 1 ;
84+ description = "Audio" ;
85+ }
86+ ] ;
87+ }
88+ ]
89+ ++ optionals config . ghaf . virtualization . microvm . appvm . vms . chrome . enable [
90+ {
91+ name = "ChromeVM" ;
92+ qmpSocket = "/var/lib/microvms/chrome-vm/chrome-vm.sock" ;
93+ usbPassthrough = [
94+ {
95+ class = 14 ;
96+ description = "Video (USB Webcams)" ;
97+ ignore = [
98+ {
99+ # Ignore Lenovo X1 camera since it is attached to the business-vm
100+ # Finland SKU
101+ vendorId = "04f2" ;
102+ productId = "b751" ;
103+ description = "Lenovo X1 Integrated Camera" ;
104+ }
105+ {
106+ # Ignore Lenovo X1 camera since it is attached to the business-vm
107+ # Uae 1st SKU
108+ vendorId = "5986" ;
109+ productId = "2145" ;
110+ description = "Lenovo X1 Integrated Camera" ;
111+ }
112+ {
113+ # Ignore Lenovo X1 camera since it is attached to the business-vm
114+ # UAE #2 SKU
115+ vendorId = "30c9" ;
116+ productId = "0052" ;
117+ description = "Lenovo X1 Integrated Camera" ;
118+ }
119+ {
120+ # Ignore Lenovo X1 gen 12 camera since it is attached to the business-vm
121+ # Finland SKU
122+ vendorId = "30c9" ;
123+ productId = "005f" ;
124+ description = "Lenovo X1 Integrated Camera" ;
125+ }
126+ ] ;
127+ }
128+ ] ;
129+ }
130+ ] ;
128131in
129132{
130133 options . ghaf . hardware . usb . vhotplug = {
0 commit comments