main
nix 90 lines 1.8 KB
Raw
1 let
2 layout = id: {
3 type = "gpt";
4 partitions = {
5 esp = {
6 type = "EF00";
7 size = "512M";
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-SAMSUNG_MZQL21T9HCJR-00A07_S64GNNFX604905";
29 content = layout "a";
30 };
31 nvme1n1 = {
32 type = "disk";
33 device = "/dev/disk/by-id/nvme-SAMSUNG_MZQL21T9HCJR-00A07_S64GNNFX604919";
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 = "on";
47 mountpoint = "none";
48 xattr = "sa";
49 };
50
51 datasets = {
52 "root" = {
53 type = "zfs_fs";
54 mountpoint = "/";
55 };
56 "nix/store" = {
57 type = "zfs_fs";
58 mountpoint = "/nix";
59 };
60 "nix/db" = {
61 type = "zfs_fs";
62 mountpoint = "/nix/var/nix/db";
63 };
64 "hydra/cache" = {
65 type = "zfs_fs";
66 mountpoint = "/var/cache/hydra";
67 };
68 "hydra/state" = {
69 type = "zfs_fs";
70 mountpoint = "/var/lib/hydra";
71 };
72 "pg" = {
73 type = "zfs_fs";
74 mountpoint = "/var/lib/postgresql";
75 options = {
76 logbias = "latency";
77 recordsize = "16K";
78 redundant_metadata = "most";
79 };
80 };
81 "reserved" = {
82 type = "zfs_fs";
83 options = {
84 canmount = "off";
85 refreservation = "16G"; # roughly one system closure
86 };
87 };
88 };
89 };
90 }