disko/example/btrfs-subvolumes.nix

53 lines
1.3 KiB
Nix
Raw Normal View History

2022-10-21 12:43:55 +00:00
{ disks ? [ "/dev/vdb" ], ... }: {
disk = {
2022-08-25 19:46:17 +00:00
vdb = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "table";
format = "gpt";
partitions = [
{
type = "partition";
name = "ESP";
start = "1MiB";
end = "128MiB";
fs-type = "fat32";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
}
{
name = "root";
type = "partition";
start = "128MiB";
end = "100%";
content = {
type = "btrfs";
2023-02-14 08:58:37 +00:00
extraArgs = [ "-f" ]; # Override existing partition
2022-12-17 17:09:10 +00:00
subvolumes = {
# Subvolume name is different from mountpoint
"/rootfs" = {
mountpoint = "/";
};
# Mountpoints inferred from subvolume name
"/home" = {
mountOptions = [ "compress=zstd" ];
2022-12-17 17:09:10 +00:00
};
"/nix" = {
mountOptions = [ "compress=zstd" "noatime" ];
2022-12-17 17:09:10 +00:00
};
"/test" = { };
2022-12-17 17:09:10 +00:00
};
};
}
];
};
2022-08-25 19:46:17 +00:00
};
};
}