Create a separate file for declaring vm fixes
This commit is contained in:
parent
47a2d4d359
commit
6aa44c7884
2 changed files with 36 additions and 21 deletions
35
lib/config/custom-build-vm.nix
Normal file
35
lib/config/custom-build-vm.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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;
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue