aboutsummaryrefslogtreecommitdiff
path: root/systems/zoldene/disko.nix
blob: 7df56976d53be2ac6fad620b0ef2d9d58897df31 (plain) (blame)
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
{ cryptKeyFile, ... }: {
  disko.devices = let
    zpoolDatasets = {
      "root"         = { type = "zfs_fs";                                options.mountpoint = "none"; };
      "root/persist" = { type = "zfs_fs"; mountpoint = "/persist/zpool"; options.mountpoint = "legacy"; };
    };
    zfastDatasets = {
      "root"         = { type = "zfs_fs"; mountpoint = "/";              options.mountpoint = "legacy"; postCreateHook = "zfs snapshot zfast/root@blank"; };
      "root/nix"     = { type = "zfs_fs"; mountpoint = "/nix";           options.mountpoint = "legacy"; };
      "root/persist" = { type = "zfs_fs"; mountpoint = "/persist/zfast"; options.mountpoint = "legacy"; };
      "root/persist/var" = { type = "zfs_fs"; mountpoint = "/persist/zfast/var"; options.mountpoint = "legacy"; };
      "root/persist/var/lib" = { type = "zfs_fs"; mountpoint = "/persist/zfast/var/lib"; options.mountpoint = "legacy"; };
    };
  in {
    disk = {
      sda = {
        type = "disk";
        device = "/dev/disk/by-id/ata-SAMSUNG_MZ7LM480HCHP-00003_S1YJNYAG700613";
        content = {
          type = "table";
          format = "gpt";
          partitions = [
            { start = "2GiB"; end = "-8GiB"; name = "ssdLuksA"; content = { type = "luks"; name = "ssdA"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zfast"; }; }; }
            { start = "-8GiB"; end = "-2MiB"; name = "swapA"; flags = [ "swap" ]; content = { type = "swap"; }; }
            { start = "2048s"; end = "4095s"; name = "ssdGrubA"; flags = [ "bios_grub" ]; }
            { start = "4096s"; end = "2GiB"; name = "ssdBootA"; content = { type = "filesystem"; format = "ext4"; mountpoint = "/boot"; }; }
          ];
        };
      };
      sdb = {
        type = "disk";
        device = "/dev/disk/by-id/ata-SAMSUNG_MZ7LM480HCHP-00003_S1YJNYAG700682";
        content = {
          type = "table";
          format = "gpt";
          partitions = [
            { start = "2GiB"; end = "-8GiB"; name = "ssdLuksB"; content = { type = "luks"; name = "ssdB"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zfast"; }; }; }
            { start = "-8GiB"; end = "-2MiB"; name = "swapB"; flags = [ "swap" ]; content = { type = "swap"; }; }
            { start = "2048s"; end = "4095s"; name = "ssdGrubB"; flags = [ "bios_grub" ]; }
            #{ start = "4096s"; end = "2GiB"; name = "ssdBootB"; content = { type = "filesystem"; format = "ext4"; }; } # non monté
          ];
        };
      };
      sdc = {
        type = "disk";
        device = "/dev/disk/by-id/ata-ST4000NM0245-1Z2107_ZC110SY1";
        content = {
          type = "table";
          format = "gpt";
          partitions = [
            { start = "2048s"; end = "-34s"; name = "hddLuksA"; content = { type = "luks"; name = "bigA"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zpool"; }; }; }
          ];
        };
      };
      sdd = {
        type = "disk";
        device = "/dev/disk/by-id/ata-ST4000NM0245-1Z2107_ZC110YXX";
        content = {
          type = "table";
          format = "gpt";
          partitions = [
            { start = "2048s"; end = "-34s"; name = "hddLuksB"; content = { type = "luks"; name = "bigB"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zpool"; }; }; }
          ];
        };
      };
    };

    zpool = {
      zpool = {
        type = "zpool";
        mode = "mirror";
        mountRoot = "/";
        rootFsOptions = { mountpoint = "none"; atime = "off"; xattr = "sa"; acltype = "posix"; };
        options = { ashift = "12"; };
        datasets = zpoolDatasets;
      };
      zfast = {
        type = "zpool";
        mode = "mirror";
        mountRoot = "/";
        rootFsOptions = { mountpoint = "none"; atime = "off"; xattr = "sa"; acltype = "posix"; };
        options = { ashift = "12"; };
        datasets = zfastDatasets;
      };
    };
  };
}