From 25b28a4ff56c0fc9561b559ad3c2c0b76cc0d4cf Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 18 Nov 2024 20:59:28 +0100 Subject: ... --- accounts/gkleen@sif/libvirt/default.nix | 98 ++++++++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 3 deletions(-) (limited to 'accounts/gkleen@sif/libvirt') diff --git a/accounts/gkleen@sif/libvirt/default.nix b/accounts/gkleen@sif/libvirt/default.nix index a5636ce2..14480d55 100644 --- a/accounts/gkleen@sif/libvirt/default.nix +++ b/accounts/gkleen@sif/libvirt/default.nix @@ -1,4 +1,4 @@ -{ flakeInputs, lib, ... }: +{ flakeInputs, lib, pkgs, ... }: with lib; with flakeInputs.nixVirt.lib; @@ -15,7 +15,7 @@ with flakeInputs.nixVirt.lib; memory = { count = 16; unit = "GiB"; }; storage_vol = "/home/gkleen/.local/share/libvirt/images/lmmirzm-vmrz01.qcow2"; nvram_path = "/home/gkleen/.local/share/libvirt/lmmirzm-vmrz01.nvram"; - virtio_drive = true; + virtio_drive = false; virtio_video = false; install_virtio = false; }) { @@ -23,6 +23,12 @@ with flakeInputs.nixVirt.lib; { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; } ]; vcpu.count = 4; + cpu = { + mode = "host-model"; + feature = [ + { name = "vmx"; policy = "require"; } + ]; + }; os.bootmenu.enable = true; devices.graphics = { listen.type = "address"; @@ -33,7 +39,7 @@ with flakeInputs.nixVirt.lib; model.type = "e1000e"; type = "bridge"; mac.address = "52:54:00:b9:f3:ed"; - source.bridge = "gre-0971"; + source.bridge = "rz-0971"; }; devices.channel = [ { @@ -44,6 +50,81 @@ with flakeInputs.nixVirt.lib; devices.tpm.model = "tpm-tis"; }); } + { definition = domain.writeXML (recursiveUpdate (domain.templates.linux { + name = "vmrz02"; + uuid = "daefc4b0-c48d-4b9d-a85d-7bd56eb068d0"; + memory = { count = 8; unit = "GiB"; }; + storage_vol = "/home/gkleen/.local/share/libvirt/images/vmrz02.qcow2"; + virtio_video = true; + }) { + os = { + loader = + { + readonly = true; + type = "pflash"; + path = "${pkgs.OVMFFull.fd}/FV/OVMF_CODE.ms.fd"; + }; + nvram = + { + template = "${pkgs.OVMFFull.fd}/FV/OVMF_VARS.ms.fd"; + path = "/home/gkleen/.local/share/libvirt/vmrz02.nvram"; + }; + bootmenu.enable = true; + }; + qemu-commandline.env = [ + { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; } + ]; + vcpu.count = 4; + cpu = { + mode = "host-model"; + feature = [ + { name = "vmx"; policy = "require"; } + ]; + }; + devices.graphics = { + listen.type = "address"; + gl.enable = false; + }; + devices.video.model.acceleration.accel3d = false; + devices.interface = [ + { + model.type = "virtio"; + type = "bridge"; + mac.address = "52:54:00:ec:d8:9d"; + source.bridge = "rz-0971"; + } + { + model.type = "virtio"; + type = "bridge"; + mac.address = "52:54:00:5e:f5:38"; + source.bridge = "rz-2403"; + } + ]; + devices.channel = [ + { + type = "unix"; + target = { type = "virtio"; name = "org.qemu.guest_agent.0"; }; + } + { + type = "spicevmc"; + target = { type = "virtio"; name = "com.redhat.spice.0"; }; + } + { + type = "spiceport"; + target = { type = "virtio"; name = "org.spice-space.webdav.0"; }; + source.channel = "org.spice-space.webdav.0"; + } + ]; + devices.tpm = { + model = "tpm-tis"; + backend = + { + type = "emulator"; + version = "2.0"; + }; + }; + }); + } ]; pools = [ { definition = pool.writeXML { @@ -67,6 +148,17 @@ with flakeInputs.nixVirt.lib; }; }; } + { definition = volume.writeXML { + type = "file"; + name = "vmrz02.qcow2"; + capacity = { count = 256; unit = "GB"; }; + target = { + path = "/home/gkleen/.local/share/libvirt/images/vmrz02.qcow2"; + format.type = "qcow2"; + features.lazy_refcounts = {}; + }; + }; + } ]; } ]; -- cgit v1.2.3