| 1 | # Matches the existing disk layout on nixos.lysator.liu.se: |
| 2 | # 3x 1.8T disks in raidz1 ZFS pool "tank", each with a 1G EFI partition |
| 3 | let |
| 4 | espPartition = mountpoint: { |
| 5 | type = "EF00"; |
| 6 | size = "1G"; |
| 7 | content = { |
| 8 | type = "filesystem"; |
| 9 | format = "vfat"; |
| 10 | inherit mountpoint; |
| 11 | mountOptions = [ |
| 12 | "fmask=0022" |
| 13 | "dmask=0022" |
| 14 | ]; |
| 15 | }; |
| 16 | }; |
| 17 | |
| 18 | zfsPart = { |
| 19 | size = "100%"; |
| 20 | content = { |
| 21 | type = "zfs"; |
| 22 | pool = "tank"; |
| 23 | }; |
| 24 | }; |
| 25 | |
| 26 | makeDisk = device: espMountpoint: { |
| 27 | inherit device; |
| 28 | type = "disk"; |
| 29 | content = { |
| 30 | type = "gpt"; |
| 31 | partitions = { |
| 32 | esp = espPartition espMountpoint; |
| 33 | zfs = zfsPart; |
| 34 | }; |
| 35 | }; |
| 36 | }; |
| 37 | in |
| 38 | { |
| 39 | disk = { |
| 40 | sda = makeDisk "/dev/disk/by-id/wwn-0x5000cca222c595d2" "/boot"; |
| 41 | sdb = makeDisk "/dev/disk/by-id/wwn-0x5000cca222c1c46e" "/boot-fallback/1"; |
| 42 | sdc = makeDisk "/dev/disk/by-id/wwn-0x5000cca222c5c6d3" "/boot-fallback/2"; |
| 43 | }; |
| 44 | |
| 45 | zpool.tank = { |
| 46 | type = "zpool"; |
| 47 | mode = "raidz1"; |
| 48 | options = { |
| 49 | ashift = "12"; |
| 50 | }; |
| 51 | rootFsOptions = { |
| 52 | compression = "on"; |
| 53 | mountpoint = "none"; |
| 54 | acltype = "posix"; |
| 55 | xattr = "on"; |
| 56 | }; |
| 57 | datasets = { |
| 58 | "root" = { |
| 59 | type = "zfs_fs"; |
| 60 | mountpoint = "/"; |
| 61 | }; |
| 62 | "nix" = { |
| 63 | type = "zfs_fs"; |
| 64 | mountpoint = "/nix"; |
| 65 | }; |
| 66 | "var" = { |
| 67 | type = "zfs_fs"; |
| 68 | mountpoint = "/var"; |
| 69 | }; |
| 70 | "home" = { |
| 71 | type = "zfs_fs"; |
| 72 | mountpoint = "/home"; |
| 73 | }; |
| 74 | }; |
| 75 | }; |
| 76 | } |