@@ -14,117 +14,125 @@ 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 = [
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
90+ (
91+ config . ghaf . virtualization . microvm . appvm . enable
92+ && config . ghaf . virtualization . microvm . appvm . vms . chrome . enable
93+ )
94+ [
8195 {
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- }
96+ name = "ChromeVM" ;
97+ qmpSocket = "/var/lib/microvms/chrome-vm/chrome-vm.sock" ;
98+ usbPassthrough = [
10699 {
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" ;
100+ class = 14 ;
101+ description = "Video (USB Webcams)" ;
102+ ignore = [
103+ {
104+ # Ignore Lenovo X1 camera since it is attached to the business-vm
105+ # Finland SKU
106+ vendorId = "04f2" ;
107+ productId = "b751" ;
108+ description = "Lenovo X1 Integrated Camera" ;
109+ }
110+ {
111+ # Ignore Lenovo X1 camera since it is attached to the business-vm
112+ # Uae 1st SKU
113+ vendorId = "5986" ;
114+ productId = "2145" ;
115+ description = "Lenovo X1 Integrated Camera" ;
116+ }
117+ {
118+ # Ignore Lenovo X1 camera since it is attached to the business-vm
119+ # UAE #2 SKU
120+ vendorId = "30c9" ;
121+ productId = "0052" ;
122+ description = "Lenovo X1 Integrated Camera" ;
123+ }
124+ {
125+ # Ignore Lenovo X1 gen 12 camera since it is attached to the business-vm
126+ # Finland SKU
127+ vendorId = "30c9" ;
128+ productId = "005f" ;
129+ description = "Lenovo X1 Integrated Camera" ;
130+ }
131+ ] ;
112132 }
113133 ] ;
114134 }
115135 ] ;
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- ] ;
128136in
129137{
130138 options . ghaf . hardware . usb . vhotplug = {
0 commit comments