Allow running qemu
in background
This commit is contained in:
parent
467b2036a7
commit
539d770d20
1 changed files with 18 additions and 2 deletions
|
@ -5,6 +5,11 @@
|
|||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
qemu.runInBackground = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -46,11 +51,22 @@
|
|||
vm
|
||||
else
|
||||
let
|
||||
prefix = lib.concatStringsSep " " (lib.optional config.virtualisation.runAsRoot "sudo");
|
||||
prefix =
|
||||
lib.concatStringsSep " " (
|
||||
lib.optionals config.virtualisation.runAsRoot (
|
||||
["sudo"] ++
|
||||
lib.optional config.virtualisation.qemu.runInBackground "-b"));
|
||||
|
||||
suffix =
|
||||
lib.concatStringsSep " " (
|
||||
lib.optional
|
||||
(!config.virtualisation.runAsRoot && config.virtualisation.qemu.runInBackground)
|
||||
"&");
|
||||
|
||||
wrapped = pkgs.writeShellApplication {
|
||||
name = "run-${config.system.name}-vm";
|
||||
text = ''
|
||||
${prefix} ${vm}/bin/run-${config.system.name}-vm
|
||||
${prefix} ${vm}/bin/run-${config.system.name}-vm ${suffix}
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
|
Loading…
Reference in a new issue