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