summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/libvirt/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/libvirt/default.nix')
-rw-r--r--accounts/gkleen@sif/libvirt/default.nix121
1 files changed, 113 insertions, 8 deletions
diff --git a/accounts/gkleen@sif/libvirt/default.nix b/accounts/gkleen@sif/libvirt/default.nix
index 4e5a9b90..43d1e455 100644
--- a/accounts/gkleen@sif/libvirt/default.nix
+++ b/accounts/gkleen@sif/libvirt/default.nix
@@ -3,24 +3,31 @@
3with lib; 3with lib;
4with flakeInputs.nixVirt.lib; 4with flakeInputs.nixVirt.lib;
5 5
6{ 6let
7 libosinfo = id: with xml;
8 elem "libosinfo:libosinfo" [ (attr "xmlns:libosinfo" "http://libosinfo.org/xmlns/libvirt/domain/1.0") ]
9 [
10 (elem "libosinfo:os" [ (attr "id" id) ] [])
11 ];
12in {
7 config = { 13 config = {
8 virtualisation.libvirt = { 14 virtualisation.libvirt = {
9 enable = true; 15 enable = true;
10 swtpm.enable = true; 16 swtpm.enable = true;
11 connections."qemu:///session" = { 17 connections."qemu:///session" = {
12 domains = [ 18 domains = [
13 { definition = domain.writeXML (updateManyAttrsByPath [ 19 { definition = domain.writeXML (recursiveUpdate (domain.templates.windows {
14 ] (recursiveUpdate (domain.templates.windows {
15 name = "lmmirzm-vmrz01"; 20 name = "lmmirzm-vmrz01";
16 uuid = "9e1dab2e-7986-4cb3-88af-6fad8969e15f"; 21 uuid = "9e1dab2e-7986-4cb3-88af-6fad8969e15f";
17 memory = { count = 16; unit = "GiB"; }; 22 memory = { count = 16; unit = "GiB"; };
18 storage_vol = "/home/gkleen/.local/share/libvirt/images/lmmirzm-vmrz01.qcow2"; 23 storage_vol = "/home/gkleen/.local/share/libvirt/images/lmmirzm-vmrz01.qcow2";
19 nvram_path = "/home/gkleen/.local/share/libvirt/lmmirzm-vmrz01.nvram"; 24 nvram_path = "/home/gkleen/.local/share/libvirt/lmmirzm-vmrz01.nvram";
20 virtio_drive = true;
21 virtio_video = true; 25 virtio_video = true;
22 install_virtio = false; 26 install_virtio = false;
23 }) { 27 }) {
28 metadata = [
29 (libosinfo "http://microsoft.com/win/11")
30 ];
24 qemu-commandline.env = [ 31 qemu-commandline.env = [
25 { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; } 32 { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; }
26 ]; 33 ];
@@ -38,8 +45,8 @@ with flakeInputs.nixVirt.lib;
38 }; 45 };
39 devices.video.model.acceleration.accel3d = false; 46 devices.video.model.acceleration.accel3d = false;
40 devices.interface = { 47 devices.interface = {
41 model.type = "virtio"; 48 # model.type = "virtio";
42 # model.type = "e1000e"; 49 model.type = "e1000e";
43 type = "bridge"; 50 type = "bridge";
44 mac.address = "52:54:00:b9:f3:ed"; 51 mac.address = "52:54:00:b9:f3:ed";
45 source.bridge = "rz-0971"; 52 source.bridge = "rz-0971";
@@ -60,7 +67,7 @@ with flakeInputs.nixVirt.lib;
60 } 67 }
61 ]; 68 ];
62 devices.tpm.model = "tpm-tis"; 69 devices.tpm.model = "tpm-tis";
63 })); 70 });
64 } 71 }
65 { definition = domain.writeXML (recursiveUpdate (domain.templates.linux { 72 { definition = domain.writeXML (recursiveUpdate (domain.templates.linux {
66 name = "vmrz02"; 73 name = "vmrz02";
@@ -74,6 +81,7 @@ with flakeInputs.nixVirt.lib;
74 { 81 {
75 readonly = true; 82 readonly = true;
76 type = "pflash"; 83 type = "pflash";
84 secure = false;
77 path = "${pkgs.OVMFFull.fd}/FV/OVMF_CODE.ms.fd"; 85 path = "${pkgs.OVMFFull.fd}/FV/OVMF_CODE.ms.fd";
78 }; 86 };
79 nvram = 87 nvram =
@@ -83,6 +91,9 @@ with flakeInputs.nixVirt.lib;
83 }; 91 };
84 bootmenu.enable = true; 92 bootmenu.enable = true;
85 }; 93 };
94 metadata = [
95 (libosinfo "http://ubuntu.com/ubuntu/20.04")
96 ];
86 qemu-commandline.env = [ 97 qemu-commandline.env = [
87 { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; } 98 { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; }
88 ]; 99 ];
@@ -137,6 +148,86 @@ with flakeInputs.nixVirt.lib;
137 }; 148 };
138 }); 149 });
139 } 150 }
151 { definition = domain.writeXML (recursiveUpdate (domain.templates.linux {
152 name = "vmrz03";
153 uuid = "1250a47c-3199-478d-8cf3-ea4a64c0567a";
154 memory = { count = 8; unit = "GiB"; };
155 storage_vol = "/home/gkleen/.local/share/libvirt/images/vmrz03.qcow2";
156 virtio_video = true;
157 }) {
158 os = {
159 loader =
160 {
161 readonly = true;
162 type = "pflash";
163 secure = false;
164 path = "${pkgs.OVMFFull.fd}/FV/OVMF_CODE.ms.fd";
165 };
166 nvram =
167 {
168 template = "${pkgs.OVMFFull.fd}/FV/OVMF_VARS.ms.fd";
169 path = "/home/gkleen/.local/share/libvirt/vmrz03.nvram";
170 };
171 bootmenu.enable = true;
172 };
173 metadata = [
174 (libosinfo "http://ubuntu.com/ubuntu/24.04")
175 ];
176 qemu-commandline.env = [
177 { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; }
178 ];
179 vcpu.count = 4;
180 cpu = {
181 mode = "host-model";
182 feature = [
183 { name = "vmx"; policy = "require"; }
184 ];
185 };
186 devices.graphics = {
187 listen.type = "address";
188 gl.enable = false;
189 };
190 devices.video.model.acceleration.accel3d = false;
191 devices.interface = [
192 {
193 model.type = "virtio";
194 type = "bridge";
195 mac.address = "52:54:00:a1:f7:8a";
196 source.bridge = "rz-0971";
197 }
198 {
199 model.type = "virtio";
200 type = "bridge";
201 mac.address = "52:54:00:8d:d3:0b";
202 source.bridge = "rz-2403";
203 link.state = "down";
204 }
205 ];
206 devices.channel = [
207 {
208 type = "unix";
209 target = { type = "virtio"; name = "org.qemu.guest_agent.0"; };
210 }
211 {
212 type = "spicevmc";
213 target = { type = "virtio"; name = "com.redhat.spice.0"; };
214 }
215 {
216 type = "spiceport";
217 target = { type = "virtio"; name = "org.spice-space.webdav.0"; };
218 source.channel = "org.spice-space.webdav.0";
219 }
220 ];
221 devices.tpm = {
222 model = "tpm-tis";
223 backend =
224 {
225 type = "emulator";
226 version = "2.0";
227 };
228 };
229 });
230 }
140 ]; 231 ];
141 pools = [ 232 pools = [
142 { definition = pool.writeXML { 233 { definition = pool.writeXML {
@@ -152,7 +243,8 @@ with flakeInputs.nixVirt.lib;
152 { definition = volume.writeXML { 243 { definition = volume.writeXML {
153 type = "file"; 244 type = "file";
154 name = "lmmirzm-vmrz01.qcow2"; 245 name = "lmmirzm-vmrz01.qcow2";
155 capacity = { count = 40; unit = "GB"; }; 246 allocation = { count = 0; };
247 capacity = { count = 256; unit = "GB"; };
156 target = { 248 target = {
157 path = "/home/gkleen/.local/share/libvirt/images/lmmirzm-vmrz01.qcow2"; 249 path = "/home/gkleen/.local/share/libvirt/images/lmmirzm-vmrz01.qcow2";
158 format.type = "qcow2"; 250 format.type = "qcow2";
@@ -163,6 +255,7 @@ with flakeInputs.nixVirt.lib;
163 { definition = volume.writeXML { 255 { definition = volume.writeXML {
164 type = "file"; 256 type = "file";
165 name = "vmrz02.qcow2"; 257 name = "vmrz02.qcow2";
258 allocation = { count = 0; };
166 capacity = { count = 256; unit = "GB"; }; 259 capacity = { count = 256; unit = "GB"; };
167 target = { 260 target = {
168 path = "/home/gkleen/.local/share/libvirt/images/vmrz02.qcow2"; 261 path = "/home/gkleen/.local/share/libvirt/images/vmrz02.qcow2";
@@ -171,6 +264,18 @@ with flakeInputs.nixVirt.lib;
171 }; 264 };
172 }; 265 };
173 } 266 }
267 { definition = volume.writeXML {
268 type = "file";
269 name = "vmrz03.qcow2";
270 allocation = { count = 0; };
271 capacity = { count = 256; unit = "GB"; };
272 target = {
273 path = "/home/gkleen/.local/share/libvirt/images/vmrz03.qcow2";
274 format.type = "qcow2";
275 features.lazy_refcounts = {};
276 };
277 };
278 }
174 ]; 279 ];
175 } 280 }
176 ]; 281 ];