diff --git a/lib/runner.nix b/lib/runner.nix index cc4b0d5d..b0f8ad81 100644 --- a/lib/runner.nix +++ b/lib/runner.nix @@ -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; diff --git a/nixos-modules/microvm/options.nix b/nixos-modules/microvm/options.nix index 5f208914..06c1199a 100644 --- a/nixos-modules/microvm/options.nix +++ b/nixos-modules/microvm/options.nix @@ -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; };