parent
1a3c10ea78
commit
1f246337a1
45 changed files with 1654 additions and 54 deletions
|
@ -6,11 +6,41 @@
|
|||
}:
|
||||
let
|
||||
cfg = config.khscodes.virtualisation.qemu-guest;
|
||||
rng = "-device virtio-rng-pci,rng=rng0 -object rng-random,id=rng0,filename=/dev/urandom";
|
||||
spice = [
|
||||
"-spice disable-ticketing=on,gl=on,unix=on,addr=/tmp/spice.sock"
|
||||
"-device virtio-serial-pci"
|
||||
"-chardev socket,id=agent0,path=vm.sock,server=on,wait=off"
|
||||
"-device virtserialport,chardev=agent0,name=org.qemu.guest_agent.0"
|
||||
"-chardev spicevmc,id=vdagent0,name=vdagent"
|
||||
"-device virtserialport,chardev=vdagent0,name=com.redhat.spice.0"
|
||||
"-chardev spiceport,id=webdav0,name=org.spice-space.webdav.0"
|
||||
"-device virtserialport,chardev=webdav0,name=org.spice-space.webdav.0"
|
||||
];
|
||||
in
|
||||
{
|
||||
options.khscodes.virtualisation.qemu-guest = {
|
||||
enable = lib.mkEnableOption "Configures machine with NixOS profile for qemu guest";
|
||||
enableWhenVmTarget = lib.mkEnableOption "Enables some enhancement settings when building as a vm";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (import "${modulesPath}/profiles/qemu-guest.nix" { });
|
||||
imports = [ "${modulesPath}/virtualisation/qemu-vm.nix" ];
|
||||
|
||||
config = lib.mkIf cfg.enableWhenVmTarget {
|
||||
virtualisation = {
|
||||
vmVariant = {
|
||||
services.qemuGuest.enable = true;
|
||||
services.spice-vdagentd.enable = true;
|
||||
khscodes.virtualisation.qemu-guest.enable = true;
|
||||
};
|
||||
memorySize = 1024 * 8;
|
||||
qemu = {
|
||||
options = [
|
||||
"-smp 8"
|
||||
"-vga none -device virtio-gpu-gl,hostmem=2G,blob=true,venus=true"
|
||||
rng
|
||||
] ++ spice;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue