summaryrefslogtreecommitdiffstats
path: root/example/gpt-bios-compat.nix
blob: 9abe69157892a9aade431ca9f6ab6145f780b3b6 (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
# Example to create a bios compatible gpt partition
{
  disk = {
    vdb = {
      device = "/dev/vdb";
      type = "disk";
      content = {
        type = "table";
        format = "gpt";
        partitions = [
          {
            name = "boot";
            type = "partition";
            start = "0";
            end = "1M";
            part-type = "primary";
            flags = ["bios_grub"];
          }
          {
            name = "root";
            type = "partition";
            # leave space for the grub aka BIOS boot
            start = "1M";
            end = "100%";
            part-type = "primary";
            bootable = true;
            content = {
              type = "filesystem";
              format = "ext4";
              mountpoint = "/";
            };
          }
        ];
      };
    };
  };
}