Allow running qemu
in background
This commit is contained in:
parent
467b2036a7
commit
539d770d20
|
@ -5,6 +5,11 @@
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
qemu.runInBackground = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,11 +51,22 @@
|
||||||
vm
|
vm
|
||||||
else
|
else
|
||||||
let
|
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 {
|
wrapped = pkgs.writeShellApplication {
|
||||||
name = "run-${config.system.name}-vm";
|
name = "run-${config.system.name}-vm";
|
||||||
text = ''
|
text = ''
|
||||||
${prefix} ${vm}/bin/run-${config.system.name}-vm
|
${prefix} ${vm}/bin/run-${config.system.name}-vm ${suffix}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in a new issue