Skip to content

Commit

Permalink
runner: make prettyProcnames configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
astro committed Feb 4, 2024
1 parent 967216a commit bc24209
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/runner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ let
preStart = hypervisorConfig.preStart or microvmConfig.preStart;
tapMultiQueue = hypervisorConfig.tapMultiQueue or false;

execArg = lib.optionalString microvmConfig.prettyProcname
''-a "microvm@${microvmConfig.hostName}"'';

runScriptBin = pkgs.buildPackages.writeScriptBin "microvm-run" ''
#! ${pkgs.buildPackages.runtimeShell} -e
${preStart}
${createVolumesScript pkgs.buildPackages microvmConfig.volumes}
${lib.optionalString (hypervisorConfig.requiresMacvtapAsFds or false) openMacvtapFds}
exec -a "microvm-${microvmConfig.hostName}" ${command}
exec ${execArg} ${command}
'';

shutdownScriptBin = pkgs.buildPackages.writeScriptBin "microvm-shutdown" ''
Expand Down
8 changes: 8 additions & 0 deletions nixos-modules/microvm/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,14 @@ in
description = "A Hypervisor's sandbox directory";
};

prettyProcnames = mkOption {
type = types.bool;
default = true;
description = ''
Set a recognizable process name right before executing the Hyperisor.
'';
};

runner = mkOption {
description = "Generated Hypervisor runner for this NixOS";
type = with types; attrsOf package;
Expand Down

0 comments on commit bc24209

Please sign in to comment.