| 1 | let |
| 2 | layout = id: { |
| 3 | type = "gpt"; |
| 4 | partitions = { |
| 5 | esp = { |
| 6 | type = "EF00"; |
| 7 | size = "1G"; |
| 8 | content = { |
| 9 | type = "filesystem"; |
| 10 | format = "vfat"; |
| 11 | mountpoint = "/efi/${id}"; |
| 12 | }; |
| 13 | }; |
| 14 | zfs = { |
| 15 | size = "100%"; |
| 16 | content = { |
| 17 | type = "zfs"; |
| 18 | pool = "zroot"; |
| 19 | }; |
| 20 | }; |
| 21 | }; |
| 22 | }; |
| 23 | in |
| 24 | { |
| 25 | disk = { |
| 26 | nvme0n1 = { |
| 27 | type = "disk"; |
| 28 | device = "/dev/disk/by-id/nvme-MTFDKCC1T9TGP-1BK1DABYY_0925109FB623"; |
| 29 | content = layout "a"; |
| 30 | }; |
| 31 | nvme1n1 = { |
| 32 | type = "disk"; |
| 33 | device = "/dev/disk/by-id/nvme-MTFDKCC1T9TGP-1BK1DABYY_0925109FB922"; |
| 34 | content = layout "b"; |
| 35 | }; |
| 36 | }; |
| 37 | |
| 38 | zpool.zroot = { |
| 39 | type = "zpool"; |
| 40 | mode = "mirror"; |
| 41 | options.ashift = "12"; |
| 42 | |
| 43 | rootFsOptions = { |
| 44 | acltype = "posixacl"; |
| 45 | atime = "off"; |
| 46 | compression = "zstd-3"; |
| 47 | mountpoint = "none"; |
| 48 | xattr = "sa"; |
| 49 | }; |
| 50 | |
| 51 | datasets = { |
| 52 | "root" = { |
| 53 | type = "zfs_fs"; |
| 54 | mountpoint = "/"; |
| 55 | }; |
| 56 | "nix" = { |
| 57 | type = "zfs_fs"; |
| 58 | mountpoint = "/nix"; |
| 59 | }; |
| 60 | "pg" = { |
| 61 | type = "zfs_fs"; |
| 62 | mountpoint = "/var/lib/postgresql"; |
| 63 | options = { |
| 64 | logbias = "latency"; |
| 65 | recordsize = "16K"; |
| 66 | redundant_metadata = "most"; |
| 67 | }; |
| 68 | }; |
| 69 | "reserved" = { |
| 70 | type = "zfs_fs"; |
| 71 | options = { |
| 72 | canmount = "off"; |
| 73 | refreservation = "16G"; # roughly one system closure |
| 74 | }; |
| 75 | }; |
| 76 | }; |
| 77 | }; |
| 78 | } |