Skip to content

Commit 1e45b07

Browse files
committed
runner: allow passing extra arguments to the VMM via preStart script
1 parent 9694139 commit 1e45b07

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/runner.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ let
4040
binScripts = microvmConfig.binScripts // {
4141
microvm-run = ''
4242
set -eou pipefail
43+
unset EXTRA_ARGS
4344
${preStart}
4445
${createVolumesScript vmHostPackages microvmConfig.volumes}
4546
${lib.optionalString (hypervisorConfig.requiresMacvtapAsFds or false) openMacvtapFds}
4647
47-
exec ${execArg} ${command}
48+
exec ${execArg} ${command} ''${EXTRA_ARGS:-}
4849
'';
4950
} // lib.optionalAttrs canShutdown {
5051
microvm-shutdown = shutdownCommand;

nixos-modules/microvm/options.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ in
5858
};
5959

6060
preStart = mkOption {
61-
description = "Commands to run before starting the hypervisor";
61+
description = ''
62+
Commands to run before starting the hypervisor.
63+
64+
Additional arguments can be passed to the hypervisor using the EXTRA_ARGS variable.
65+
'';
6266
default = "";
6367
type = types.lines;
6468
};

0 commit comments

Comments
 (0)