Clean up vm config file
This commit is contained in:
parent
1ea8734a9c
commit
8b4c67b89d
|
@ -16,37 +16,6 @@ let
|
|||
(item: { inherit (item) file value; }));
|
||||
|
||||
vanillaVM = mergedSystemOption.mergedValue.vm;
|
||||
|
||||
createVMWrapper =
|
||||
vm:
|
||||
if (vm.name == packageName)
|
||||
then
|
||||
vm
|
||||
else
|
||||
let
|
||||
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 ${suffix}
|
||||
'';
|
||||
};
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
name = packageName;
|
||||
paths = [ wrapped ];
|
||||
};
|
||||
in {
|
||||
options =
|
||||
let
|
||||
|
@ -106,7 +75,38 @@ in {
|
|||
# Replace native `qemu` with `remote-viewer`
|
||||
system.build =
|
||||
{
|
||||
vm = lib.mkForce (createVMWrapper vanillaVM);
|
||||
vm = lib.mkForce (
|
||||
(
|
||||
vm:
|
||||
if (vm.name == packageName)
|
||||
then
|
||||
vm
|
||||
else
|
||||
let
|
||||
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 ${suffix}
|
||||
'';
|
||||
};
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
name = packageName;
|
||||
paths = [ wrapped ];
|
||||
})
|
||||
vanillaVM);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue