Create a separate file for declaring vm fixes

This commit is contained in:
Manuel Thalmann 2024-04-30 13:08:18 +02:00
parent 47a2d4d359
commit 6aa44c7884
2 changed files with 36 additions and 21 deletions

View file

@ -0,0 +1,35 @@
{ 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 config = {
boot.loader.efi.efiSysMountPoint = lib.mkForce "/boot";
virtualisation = {
qemu.options = [
"-display sdl"
];
sharedDirectories = {
hostKeys = {
source = "/etc/ssh";
target = "/etc/ssh";
};
};
};
};
in {
vmVariant = config;
vmVariantWithBootLoader = config;
};
};
}

View file

@ -17,29 +17,9 @@
{ config, pkgs, lib, ... }: {
imports = [
machineConfig
./config/custom-build-vm.nix
];
virtualisation =
let
config = {
boot.loader.efi.efiSysMountPoint = lib.mkVMOverride "/boot";
virtualisation.qemu.options = [
"-display sdl"
];
virtualisation.sharedDirectories = {
keys = {
source = "/etc/ssh";
target = "/etc/ssh";
};
};
};
in {
vmVariant = config;
vmVariantWithBootLoader = config;
};
# Networking
networking.hostName = name;
})