summaryrefslogtreecommitdiffstats
path: root/example/btrfs-subvolumes.nix
diff options
context:
space:
mode:
Diffstat (limited to 'example/btrfs-subvolumes.nix')
-rw-r--r--example/btrfs-subvolumes.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/example/btrfs-subvolumes.nix b/example/btrfs-subvolumes.nix
new file mode 100644
index 0000000..25994df
--- /dev/null
+++ b/example/btrfs-subvolumes.nix
@@ -0,0 +1,52 @@
+{ disks ? [ "/dev/vdb" ], ... }: {
+ disk = {
+ 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";
+ extraArgs = "-f"; # Override existing partition
+ subvolumes = {
+ # Subvolume name is different from mountpoint
+ "/rootfs" = {
+ mountpoint = "/";
+ };
+ # Mountpoints inferred from subvolume name
+ "/home" = {
+ mountOptions = ["compress=zstd"];
+ };
+ "/nix" = {
+ mountOptions = ["compress=zstd" "noatime"];
+ };
+ "/test" = {};
+ };
+ };
+ }
+ ];
+ };
+ };
+ };
+}
+