File tree Expand file tree Collapse file tree 2 files changed +34
-19
lines changed Expand file tree Collapse file tree 2 files changed +34
-19
lines changed Original file line number Diff line number Diff line change 64
64
65
65
accel =
66
66
if microvmConfig . cpu == null
67
- then "accel= kvm:tcg"
68
- else "accel= tcg" ;
67
+ then "kvm:tcg"
68
+ else "tcg" ;
69
69
70
70
# PCI required by vfio-pci for PCI passthrough
71
71
pciInDevices = lib . any ( { bus , ... } : bus == "pci" ) devices ;
75
75
shares != [ ] ||
76
76
pciInDevices ;
77
77
78
- machineConfig = builtins . concatStringsSep "," {
79
- x86_64-linux = [
80
- machine
81
- accel
82
- "mem-merge=on"
83
- "acpi=on"
84
- ] ++ lib . optionals ( machine == "microvm" ) [
85
- "pit=off"
86
- "pic=off"
87
- "pcie=${ if requirePci then "on" else "off" } "
88
- "usb=${ if requireUsb then "on" else "off" } "
89
- ] ;
90
- aarch64-linux = [
91
- "virt"
92
- "gic-version=max,${ accel } "
93
- ] ;
94
- } . ${ system } ;
78
+ machineOpts =
79
+ if microvmConfig . qemu . machineOpts != null
80
+ then microvmConfig . qemu . machineOpts
81
+ else {
82
+ x86_64-linux = {
83
+ inherit accel ;
84
+ mem-merge = "on" ;
85
+ acpi = "on" ;
86
+ } // lib . optionalAttrs ( machine == "microvm" ) {
87
+ pit = "off" ;
88
+ pic = "off" ;
89
+ pcie = if requirePci then "on" else "off" ;
90
+ usb = if requireUsb then "on" else "off" ;
91
+ } ;
92
+ aarch64-linux = {
93
+ inherit accel ;
94
+ gic-version = "max" ;
95
+ } ;
96
+ } . ${ system } ;
97
+
98
+ machineConfig = builtins . concatStringsSep "," (
99
+ [ machine ] ++
100
+ map ( name :
101
+ "${ name } =${ machineOpts . ${ name } } "
102
+ ) ( builtins . attrNames machineOpts )
103
+ ) ;
95
104
96
105
devType =
97
106
if requirePci
Original file line number Diff line number Diff line change 406
406
'' ;
407
407
} ;
408
408
409
+ qemu . machineOpts = mkOption {
410
+ type = with types ; nullOr ( attrsOf str ) ;
411
+ default = null ;
412
+ description = "Overwrite the default machine model options." ;
413
+ } ;
414
+
409
415
qemu . extraArgs = mkOption {
410
416
type = with types ; listOf str ;
411
417
default = [ ] ;
You can’t perform that action at this time.
0 commit comments