main
nix 69 lines 1.15 KB
Raw
1 {
2 disk1 ? "/dev/nvme0n1",
3 disk2 ? "/dev/nvme1n1",
4 }:
5 let
6 mkDiskLayout = id: {
7 type = "gpt";
8 partitions = {
9 esp = {
10 type = "EF00";
11 size = "512M";
12 content = {
13 type = "filesystem";
14 format = "vfat";
15 mountpoint = "/efi/${id}";
16 };
17 };
18 zdev = {
19 size = "100%";
20 content = {
21 type = "zfs";
22 pool = "zroot";
23 };
24 };
25 };
26 };
27 in
28 {
29 disk = {
30 a = {
31 type = "disk";
32 device = disk1;
33 content = mkDiskLayout "a";
34 };
35
36 b = {
37 type = "disk";
38 device = disk2;
39 content = mkDiskLayout "b";
40 };
41 };
42
43 zpool.zroot = {
44 mode = ""; # RAID 0
45 options.ashift = "12"; # 4k blocks
46
47 rootFsOptions = {
48 acltype = "posixacl";
49 atime = "off";
50 compression = "on";
51 mountpoint = "none";
52 xattr = "sa";
53 };
54
55 datasets = {
56 root = {
57 type = "zfs_fs";
58 mountpoint = "/";
59 };
60 reserved = {
61 type = "zfs_fs";
62 options = {
63 canmount = "off";
64 refreservation = "16G"; # roughly one system closure
65 };
66 };
67 };
68 };
69 }