summaryrefslogtreecommitdiffstats
path: root/lass/1systems/neoprism/disk.nix
blob: c5bd44c94d39ebb0b5bb80898c0baa9adc734a23 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{ lib, ... }:
{
  disk = (lib.genAttrs [ "/dev/nvme0n1" "/dev/nvme1n1" ] (disk: {
    type = "disk";
    device = disk;
    content = {
      type = "gpt";
      partitions = {
        boot = {
          size = "1M";
          type = "EF02";
        };
        ESP = {
          size = "1G";
          content = {
            type = "mdraid";
            name = "boot";
          };
        };
        zfs = {
          size = "100%";
          content = {
            type = "zfs";
            pool = "zroot";
          };
        };
      };
    };
  })) // {
    hdd1 = {
      type = "disk";
      device = "/dev/sda";
      content = {
        type = "zfs";
        pool = "tank";
      };
    };
  };
  mdadm = {
    boot = {
      type = "mdadm";
      level = 1;
      metadata = "1.0";
      content = {
        type = "filesystem";
        format = "vfat";
        mountpoint = "/boot";
      };
    };
  };
  zpool = {
    zroot = {
      type = "zpool";
      mode = "mirror";
      mountpoint = "/";
      rootFsOptions = {
      };
      datasets.reserved = {
        type = "zfs_fs";
        options.refreservation = "1G";
      };
    };
    tank = {
      type = "zpool";
      datasets = {
        reserved = {
          type = "zfs_fs";
          options.refreservation = "1G";
        };
        containers = {
          type = "zfs_fs";
          mountpoint = "/var/lib/containers";
          options = {
            canmount = "noauto";
          };
        };
        home = {
          type = "zfs_fs";
          mountpoint = "/home";
          options = {
            canmount = "noauto";
          };
        };
        srv = {
          type = "zfs_fs";
          mountpoint = "/srv";
          options = {
            canmount = "noauto";
          };
        };
        libvirt = {
          type = "zfs_fs";
          mountpoint = "/var/lib/libvirt";
          options = {
            canmount = "noauto";
          };
        };
        # encrypted = {
        #   type = "zfs_fs";
        #   options = {
        #     canmount = "noauto";
        #     mountpoint = "none";
        #     encryption = "aes-256-gcm";
        #     keyformat = "passphrase";
        #     keylocation = "prompt";
        #   };
        # };
        # "encrypted/download" = {
        #   type = "zfs_fs";
        #   mountpoint = "/var/download";
        #   options = {
        #     canmount = "noauto";
        #   };
        # };
      };
    };
  };
}