Skip to content
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
5 changes: 4 additions & 1 deletion lib/runner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ let
${preStart}
${createVolumesScript vmHostPackages microvmConfig.volumes}
${lib.optionalString (hypervisorConfig.requiresMacvtapAsFds or false) openMacvtapFds}
runtime_args=${lib.optionalString (microvmConfig.extraArgsScript != null) ''
$(${microvmConfig.extraArgsScript})
''}

exec ${execArg} ${command}
exec ${execArg} ${command} ''${runtime_args:-}
'';
} // lib.optionalAttrs canShutdown {
microvm-shutdown = shutdownCommand;
Expand Down
10 changes: 10 additions & 0 deletions nixos-modules/microvm/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ in
type = types.lines;
};

extraArgsScript = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
A script to provide additional arguments for the hypervisor at runtime.

The script must output a single line with arguments for the hypervisor.
'';
};

socket = mkOption {
description = "Hypervisor control socket path";
default = "${hostName}.sock";
Expand Down