how to display niri on qemu?
#Qemu/KVM with virt-manager
{
config,
hostname,
lib,
username,
...
}: {
programs = {
virt-manager.enable = true;
};
services = {
qemuGuest.enable = true;
spice-autorandr.enable = true;
spice-vdagentd.enable = true; # enable copy and paste between host and guest
};
users.users."${username}".extraGroups = lib.optional config.virtualisation.libvirtd.enable "libvirtd";
virtualisation = {
libvirtd = {
enable = true;
# onBoot = "ignore";
};
spiceUSBRedirection.enable = true;
# for nixosvmtest
vmVariant = lib.mkIf (hostname == "vm") {
# following configuration is added only when building VM with build-vm
virtualisation = {
cores = 3;
memorySize = 2048; # Use 2048MiB memory.
graphics = true;
forwardPorts = [
{
from = "host";
host.port = 2221;
guest.port = 22;
}
];
qemu.options = [
# Better display option
"-vga virtio"
"-display gtk,zoom-to-fit=false"
# Enable copy/paste
# https://www.kraxel.org/blog/2021/05/qemu-cut-paste/
"-chardev qemu-vdagent,id=ch1,name=vdagent,clipboard=on"
"-device virtio-serial-pci"
"-device virtserialport,chardev=ch1,id=ch1,name=com.redhat.spice.0"
];
};
};
};
}