Skip to content

Allow passing extra arguments to the VMM via preStart script #393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/runner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ let
binScripts = microvmConfig.binScripts // {
microvm-run = ''
set -eou pipefail
unset EXTRA_ARGS
${preStart}
${createVolumesScript vmHostPackages microvmConfig.volumes}
${lib.optionalString (hypervisorConfig.requiresMacvtapAsFds or false) openMacvtapFds}

exec ${execArg} ${command}
exec ${execArg} ${command} ''${EXTRA_ARGS:-}
'';
} // lib.optionalAttrs canShutdown {
microvm-shutdown = shutdownCommand;
Expand Down
6 changes: 5 additions & 1 deletion nixos-modules/microvm/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ in
};

preStart = mkOption {
description = "Commands to run before starting the hypervisor";
description = ''
Commands to run before starting the hypervisor.

Additional arguments can be passed to the hypervisor using the EXTRA_ARGS variable.
'';
default = "";
type = types.lines;
};
Expand Down