Skip to content

Commit 51320d3

Browse files
committed
Add an option to allow passing extra arguments to the VMM at runtime
1 parent 9694139 commit 51320d3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/runner.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ let
4343
${preStart}
4444
${createVolumesScript vmHostPackages microvmConfig.volumes}
4545
${lib.optionalString (hypervisorConfig.requiresMacvtapAsFds or false) openMacvtapFds}
46+
runtime_args=${lib.optionalString (microvmConfig.extraArgsScript != null) ''
47+
$(${microvmConfig.extraArgsScript})
48+
''}
4649
47-
exec ${execArg} ${command}
50+
exec ${execArg} ${command} ''${runtime_args:-}
4851
'';
4952
} // lib.optionalAttrs canShutdown {
5053
microvm-shutdown = shutdownCommand;

nixos-modules/microvm/options.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ in
6363
type = types.lines;
6464
};
6565

66+
extraArgsScript = mkOption {
67+
type = types.nullOr types.str;
68+
default = null;
69+
description = ''
70+
A script to provide additional arguments for the hypervisor at runtime.
71+
72+
The script must output a single line with arguments for the hypervisor.
73+
'';
74+
};
75+
6676
socket = mkOption {
6777
description = "Hypervisor control socket path";
6878
default = "${hostName}.sock";

0 commit comments

Comments
 (0)