Allow substituting any vm command

This commit is contained in:
Manuel Thalmann 2024-04-30 15:00:02 +02:00
parent c428a2486d
commit 20f1bdaa13

View file

@ -1,13 +1,25 @@
{ config, lib, pkgs, ... }: {
config = {
# Replace native `qemu` with `remote-viewer`
system.build = {
vmWithBootLoader = pkgs.writeShellApplication {
{ config, lib, pkgs, ... }:
let
createVmRunner =
vmVariant:
pkgs.writeShellApplication {
name = "run-${config.system.name}-vm";
text = ''
${config.virtualisation.vmVariant.system.build.vm}/bin/run-${config.system.name}-vm
${vmVariant.system.build.vm}/bin/run-${config.system.name}-vm
'';
};
in
{
config = {
# Replace native `qemu` with `remote-viewer`
system.build =
with {
inherit (config.virtualisation)
vmVariantWithBootLoader
;
};
{
vmWithBootLoader = createVmRunner vmVariantWithBootLoader;
};
virtualisation =
@ -28,8 +40,7 @@
};
};
in {
vmVariant = vmConfig;
vmVariantWithBootLoader = vmConfig;
};
};
}
}