summaryrefslogtreecommitdiffstats
path: root/example/complex.nix
blob: 078f9c5aeb693ce8754a7213397fdfe528331534 (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{
  disk = {
    disk1 = {
      type = "disk";
      device = "/dev/vdb";
      content = {
        type = "table";
        format = "gpt";
        partitions = [
          {
            type = "partition";
            start = "0";
            end = "1M";
            name = "grub";
            flags = ["bios_grub"];
          }
          {
            type = "partition";
            start = "1M";
            end = "100%";
            name = "luks";
            bootable = true;
            content = {
              type = "luks";
              name = "crypted1";
              keyFile = "/tmp/secret.key";
              extraArgs = [
                "--hash sha512"
                "--iter-time 5000"
              ];
              content = {
                type = "lvm_pv";
                vg = "pool";
              };
            };
          }
        ];
      };
    };
    disk2 = {
      type = "disk";
      device = "/dev/vdc";
      content = {
        type = "table";
        format = "gpt";
        partitions = [
          {
            type = "partition";
            start = "0";
            end = "1M";
            name = "grub";
            flags = ["bios_grub"];
          }
          {
            type = "partition";
            start = "1M";
            end = "100%";
            name = "luks";
            bootable = true;
            content = {
              type = "luks";
              name = "crypted2";
              keyFile = "/tmp/secret.key";
              extraArgs = [
                "--hash sha512"
                "--iter-time 5000"
              ];
              content = {
                type = "lvm_pv";
                vg = "pool";
              };
            };
          }
        ];
      };
    };
  };
  mdadm = {
    raid1 = {
      type = "mdadm";
      level = 1;
      content = {
        type = "table";
        format = "msdos";
        partitions = [
          {
            type = "partition";
            name = "xfs";
            start = "1MiB";
            end = "100%";
            content = {
              type = "filesystem";
              format = "xfs";
              mountpoint = "/xfs_mdadm_lvm";
            };
          }
        ];
      };
    };
  };
  lvm_vg = {
    pool = {
      type = "lvm_vg";
      lvs = {
        root = {
          type = "lvm_lv";
          size = "10M";
          lvm_type = "mirror";
          content = {
            type = "filesystem";
            format = "ext4";
            mountpoint = "/ext4_on_lvm";
            options = [
              "defaults"
            ];
          };
        };
        raid1 = {
          type = "lvm_lv";
          size = "30M";
          lvm_type = "raid0";
          content = {
            type = "mdraid";
            name = "raid1";
          };
        };
        raid2 = {
          type = "lvm_lv";
          size = "30M";
          lvm_type = "raid0";
          content = {
            type = "mdraid";
            name = "raid1";
          };
        };
        zfs1 = {
          type = "lvm_lv";
          size = "128M";
          lvm_type = "raid0";
          content = {
            type = "zfs";
            pool = "zroot";
          };
        };
        zfs2 = {
          type = "lvm_lv";
          size = "128M";
          lvm_type = "raid0";
          content = {
            type = "zfs";
            pool = "zroot";
          };
        };
      };
    };
  };
  zpool = {
    zroot = {
      type = "zpool";
      mode = "mirror";
      rootFsOptions = {
        compression = "lz4";
        "com.sun:auto-snapshot" = "false";
      };
      mountpoint = "/";

      datasets = {
        zfs_fs = {
          zfs_type = "filesystem";
          mountpoint = "/zfs_fs";
          options."com.sun:auto-snapshot" = "true";
        };
        zfs_unmounted_fs = {
          zfs_type = "filesystem";
          options.mountpoint = "none";
        };
        zfs_legacy_fs = {
          zfs_type = "filesystem";
          options.mountpoint = "legacy";
          mountpoint = "/zfs_legacy_fs";
        };
        zfs_testvolume = {
          zfs_type = "volume";
          size = "10M";
          content = {
            type = "filesystem";
            format = "ext4";
            mountpoint = "/ext4onzfs";
          };
        };
      };
    };
  };
}