NixOSConfig/lib/config/custom-build-vm.nix

36 lines
835 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }: {
config = {
# Replace native `qemu` with `remote-viewer`
system.build = {
vmWithBootLoader = pkgs.writeShellApplication {
name = "run-${config.system.name}-vm";
text = ''
${config.virtualisation.vmVariant.system.build.vm}/bin/run-${config.system.name}-vm
'';
};
};
virtualisation =
let vmConfig = {
boot.loader.efi.efiSysMountPoint = lib.mkForce "/boot";
virtualisation = {
qemu.options = [
"-display sdl"
];
sharedDirectories = {
hostKeys = {
source = "/etc/ssh";
target = "/etc/ssh";
};
};
};
};
in {
vmVariant = vmConfig;
vmVariantWithBootLoader = vmConfig;
};
};
}