1{
2 config,
3 lib,
4 ...
5}: {
6 options.myDisko.installDrive = lib.mkOption {
7 description = "Disk to install NixOS to.";
8 default = "/dev/sda1";
9 type = lib.types.str;
10 };
11
12 config = {
13 assertions = [
14 {
15 assertion = config.myDisko.installDrive != "";
16 message = "config.myDisko.installDrive cannot be empty.";
17 }
18 ];
19
20 disko.devices = {
21 disk = {
22 main = {
23 type = "disk";
24 device = config.myDisko.installDrive;
25
26 content = {
27 type = "gpt";
28
29 partitions = {
30 ESP = {
31 content = {
32 format = "vfat";
33 mountOptions = ["umask=0077"];
34 mountpoint = "/boot";
35 type = "filesystem";
36 };
37
38 end = "1024M";
39 name = "ESP";
40 priority = 1;
41 start = "1M";
42 type = "EF00";
43 };
44
45 root = {
46 size = "100%";
47 content = {
48 type = "btrfs";
49 extraArgs = ["-f"]; # Override existing partition
50
51 subvolumes = {
52 "/rootfs" = {
53 mountOptions = ["compress=zstd" "noatime"];
54 mountpoint = "/";
55 };
56
57 "/home" = {
58 mountOptions = ["compress=zstd" "noatime"];
59 mountpoint = "/home";
60 };
61
62 "/home/.snapshots" = {
63 mountOptions = ["compress=zstd" "noatime"];
64 mountpoint = "/home/.snapshots";
65 };
66
67 "/nix" = {
68 mountOptions = ["compress=zstd" "noatime"];
69 mountpoint = "/nix";
70 };
71 };
72
73 mountpoint = "/partition-root";
74 };
75 };
76 };
77 };
78 };
79 };
80 };
81 };
82}