summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/libvirt/default.nix
blob: 076a0d86f31a3589c81822baf00c1336eeccc012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ flakeInputs, lib, ... }:

with lib;
with flakeInputs.nixVirt.lib;

{
  config = {
    virtualisation.libvirt = {
      enable = true;
      connections."qemu:///session" = {
        domains = [
          { definition = domain.writeXML (recursiveUpdate (domain.templates.windows {
              name = "lmmirzm-vmrz01";
              uuid = "9e1dab2e-7986-4cb3-88af-6fad8969e15f";
              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_video = false;
              install_virtio = false;
            }) {
              qemu-commandline.env = [
                { name = "SPICE_DEBUG_ALLOW_MC"; value = "1"; }
              ];
              vcpu.count = 4;
              os.bootmenu.enable = true;
              devices.graphics = {
                listen.type = "address";
                # gl.enable = true;
              };
              devices.interface = {
                model.type = "virtio";
                type = "bridge";
                mac.address = "52:54:00:b9:f3:ed";
                source.bridge = "gre-0971";
              };
              devices.channel = [
                {
                  type = "unix";
                  target = { type = "virtio"; name = "org.qemu.guest_agent.0"; };
                }
              ];
              devices.tpm.model = "tpm-tis";
            });
          }
        ];
        pools = [
          { definition = pool.writeXML {
              type = "dir";
              name = "default";
              uuid = "ad899c92-02e3-45f9-bf49-195467aba2e2";
              target = {
                path = "/home/gkleen/.local/share/libvirt/images";
              };
            };
            active = true;
            volumes = [
              { definition = volume.writeXML {
                  type = "file";
                  name = "lmmirzm-vmrz01.qcow2";
                  capacity = { count = 40; unit = "GB"; };
                  target = {
                    path = "/home/gkleen/.local/share/libvirt/images/lmmirzm-vmrz01.qcow2";
                    format.type = "qcow2";
                    features.lazy_refcounts = {};
                  };
                };
              }
            ];
          }
        ];
      };
    };
  };
}