diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2024-11-18 20:59:28 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2024-11-18 20:59:28 +0100 |
commit | 25b28a4ff56c0fc9561b559ad3c2c0b76cc0d4cf (patch) | |
tree | 17a20fe69f6a478c32c7257288fef6f781a44a3b /accounts/gkleen@sif/libvirt | |
parent | f805ce37981a699981ae25dfd1943dc3db33b90e (diff) | |
download | nixos-25b28a4ff56c0fc9561b559ad3c2c0b76cc0d4cf.tar nixos-25b28a4ff56c0fc9561b559ad3c2c0b76cc0d4cf.tar.gz nixos-25b28a4ff56c0fc9561b559ad3c2c0b76cc0d4cf.tar.bz2 nixos-25b28a4ff56c0fc9561b559ad3c2c0b76cc0d4cf.tar.xz nixos-25b28a4ff56c0fc9561b559ad3c2c0b76cc0d4cf.zip |
...
Diffstat (limited to 'accounts/gkleen@sif/libvirt')
-rw-r--r-- | accounts/gkleen@sif/libvirt/default.nix | 98 |
1 files changed, 95 insertions, 3 deletions
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 @@ | |||
1 | { flakeInputs, lib, ... }: | 1 | { flakeInputs, lib, pkgs, ... }: |
2 | 2 | ||
3 | with lib; | 3 | with lib; |
4 | with flakeInputs.nixVirt.lib; | 4 | with flakeInputs.nixVirt.lib; |
@@ -15,7 +15,7 @@ with flakeInputs.nixVirt.lib; | |||
15 | memory = { count = 16; unit = "GiB"; }; | 15 | memory = { count = 16; unit = "GiB"; }; |
16 | storage_vol = "/home/gkleen/.local/share/libvirt/images/lmmirzm-vmrz01.qcow2"; | 16 | storage_vol = "/home/gkleen/.local/share/libvirt/images/lmmirzm-vmrz01.qcow2"; |
17 | nvram_path = "/home/gkleen/.local/share/libvirt/lmmirzm-vmrz01.nvram"; | 17 | nvram_path = "/home/gkleen/.local/share/libvirt/lmmirzm-vmrz01.nvram"; |
18 | virtio_drive = true; | 18 | virtio_drive = false; |
19 | virtio_video = false; | 19 | virtio_video = false; |
20 | install_virtio = false; | 20 | install_virtio = false; |
21 | }) { | 21 | }) { |
@@ -23,6 +23,12 @@ with flakeInputs.nixVirt.lib; | |||
23 | { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; } | 23 | { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; } |
24 | ]; | 24 | ]; |
25 | vcpu.count = 4; | 25 | vcpu.count = 4; |
26 | cpu = { | ||
27 | mode = "host-model"; | ||
28 | feature = [ | ||
29 | { name = "vmx"; policy = "require"; } | ||
30 | ]; | ||
31 | }; | ||
26 | os.bootmenu.enable = true; | 32 | os.bootmenu.enable = true; |
27 | devices.graphics = { | 33 | devices.graphics = { |
28 | listen.type = "address"; | 34 | listen.type = "address"; |
@@ -33,7 +39,7 @@ with flakeInputs.nixVirt.lib; | |||
33 | model.type = "e1000e"; | 39 | model.type = "e1000e"; |
34 | type = "bridge"; | 40 | type = "bridge"; |
35 | mac.address = "52:54:00:b9:f3:ed"; | 41 | mac.address = "52:54:00:b9:f3:ed"; |
36 | source.bridge = "gre-0971"; | 42 | source.bridge = "rz-0971"; |
37 | }; | 43 | }; |
38 | devices.channel = [ | 44 | devices.channel = [ |
39 | { | 45 | { |
@@ -44,6 +50,81 @@ with flakeInputs.nixVirt.lib; | |||
44 | devices.tpm.model = "tpm-tis"; | 50 | devices.tpm.model = "tpm-tis"; |
45 | }); | 51 | }); |
46 | } | 52 | } |
53 | { definition = domain.writeXML (recursiveUpdate (domain.templates.linux { | ||
54 | name = "vmrz02"; | ||
55 | uuid = "daefc4b0-c48d-4b9d-a85d-7bd56eb068d0"; | ||
56 | memory = { count = 8; unit = "GiB"; }; | ||
57 | storage_vol = "/home/gkleen/.local/share/libvirt/images/vmrz02.qcow2"; | ||
58 | virtio_video = true; | ||
59 | }) { | ||
60 | os = { | ||
61 | loader = | ||
62 | { | ||
63 | readonly = true; | ||
64 | type = "pflash"; | ||
65 | path = "${pkgs.OVMFFull.fd}/FV/OVMF_CODE.ms.fd"; | ||
66 | }; | ||
67 | nvram = | ||
68 | { | ||
69 | template = "${pkgs.OVMFFull.fd}/FV/OVMF_VARS.ms.fd"; | ||
70 | path = "/home/gkleen/.local/share/libvirt/vmrz02.nvram"; | ||
71 | }; | ||
72 | bootmenu.enable = true; | ||
73 | }; | ||
74 | qemu-commandline.env = [ | ||
75 | { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; } | ||
76 | ]; | ||
77 | vcpu.count = 4; | ||
78 | cpu = { | ||
79 | mode = "host-model"; | ||
80 | feature = [ | ||
81 | { name = "vmx"; policy = "require"; } | ||
82 | ]; | ||
83 | }; | ||
84 | devices.graphics = { | ||
85 | listen.type = "address"; | ||
86 | gl.enable = false; | ||
87 | }; | ||
88 | devices.video.model.acceleration.accel3d = false; | ||
89 | devices.interface = [ | ||
90 | { | ||
91 | model.type = "virtio"; | ||
92 | type = "bridge"; | ||
93 | mac.address = "52:54:00:ec:d8:9d"; | ||
94 | source.bridge = "rz-0971"; | ||
95 | } | ||
96 | { | ||
97 | model.type = "virtio"; | ||
98 | type = "bridge"; | ||
99 | mac.address = "52:54:00:5e:f5:38"; | ||
100 | source.bridge = "rz-2403"; | ||
101 | } | ||
102 | ]; | ||
103 | devices.channel = [ | ||
104 | { | ||
105 | type = "unix"; | ||
106 | target = { type = "virtio"; name = "org.qemu.guest_agent.0"; }; | ||
107 | } | ||
108 | { | ||
109 | type = "spicevmc"; | ||
110 | target = { type = "virtio"; name = "com.redhat.spice.0"; }; | ||
111 | } | ||
112 | { | ||
113 | type = "spiceport"; | ||
114 | target = { type = "virtio"; name = "org.spice-space.webdav.0"; }; | ||
115 | source.channel = "org.spice-space.webdav.0"; | ||
116 | } | ||
117 | ]; | ||
118 | devices.tpm = { | ||
119 | model = "tpm-tis"; | ||
120 | backend = | ||
121 | { | ||
122 | type = "emulator"; | ||
123 | version = "2.0"; | ||
124 | }; | ||
125 | }; | ||
126 | }); | ||
127 | } | ||
47 | ]; | 128 | ]; |
48 | pools = [ | 129 | pools = [ |
49 | { definition = pool.writeXML { | 130 | { definition = pool.writeXML { |
@@ -67,6 +148,17 @@ with flakeInputs.nixVirt.lib; | |||
67 | }; | 148 | }; |
68 | }; | 149 | }; |
69 | } | 150 | } |
151 | { definition = volume.writeXML { | ||
152 | type = "file"; | ||
153 | name = "vmrz02.qcow2"; | ||
154 | capacity = { count = 256; unit = "GB"; }; | ||
155 | target = { | ||
156 | path = "/home/gkleen/.local/share/libvirt/images/vmrz02.qcow2"; | ||
157 | format.type = "qcow2"; | ||
158 | features.lazy_refcounts = {}; | ||
159 | }; | ||
160 | }; | ||
161 | } | ||
70 | ]; | 162 | ]; |
71 | } | 163 | } |
72 | ]; | 164 | ]; |