1{
2 config,
3 lib,
4 ...
5}: {
6 options.myDisko.installDrive = lib.mkOption {
7 description = "Disk to install NixOS to.";
8 default = "/dev/vda";
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 disko.devices = {
20 disk.main = {
21 type = "disk";
22 device = config.myDisko.installDrive;
23 content = {
24 type = "gpt";
25 partitions = {
26 boot = {
27 size = "1M";
28 type = "EF02";
29 priority = 1;
30 };
31 ESP = {
32 size = "512M";
33 type = "EF00";
34 content = {
35 type = "filesystem";
36 format = "vfat";
37 mountpoint = "/boot";
38 };
39 };
40 root = {
41 size = "100%";
42 content = {
43 type = "lvm_pv";
44 vg = "root_vg";
45 };
46 };
47 };
48 };
49 };
50 lvm_vg = {
51 root_vg = {
52 type = "lvm_vg";
53 lvs = {
54 root = {
55 size = "100%FREE";
56 content = {
57 type = "btrfs";
58 extraArgs = ["-f"];
59 subvolumes = {
60 "/root" = {
61 mountpoint = "/";
62 mountOptions = ["noatime" "compress=zstd"];
63 };
64 "/nix" = {
65 mountOptions = ["subvol=nix" "noatime" "compress=zstd"];
66 mountpoint = "/nix";
67 };
68 };
69 };
70 };
71 };
72 };
73 };
74 };
75 };
76}