From f484389085ea1ebd697516510d944dec55515288 Mon Sep 17 00:00:00 2001 From: dylan madisetti Date: Thu, 1 Aug 2024 16:00:11 -0400 Subject: [PATCH] example: barebones example of zfs-with-vdevs --- example/zfs-with-vdevs.nix | 114 +++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 example/zfs-with-vdevs.nix diff --git a/example/zfs-with-vdevs.nix b/example/zfs-with-vdevs.nix new file mode 100644 index 0000000..cd85add --- /dev/null +++ b/example/zfs-with-vdevs.nix @@ -0,0 +1,114 @@ +{ + disko.devices = { + disk = { + x = { + type = "disk"; + device = "/dev/sdx"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "64M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "zroot"; + }; + }; + }; + }; + }; + y = { + type = "disk"; + device = "/dev/sdy"; + content = { + type = "gpt"; + partitions = { + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "zroot"; + }; + }; + }; + }; + }; + z = { + type = "disk"; + device = "/dev/sdz"; + content = { + type = "gpt"; + partitions = { + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "zroot"; + }; + }; + }; + }; + }; + cache = { + type = "disk"; + device = "/dev/sdc"; + content = { + type = "gpt"; + partitions = { + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "zroot"; + }; + }; + }; + }; + }; + }; + zpool = { + zroot = { + type = "zpool"; + mode = "prescribed"; + rootFsOptions = { + compression = "zstd"; + "com.sun:auto-snapshot" = "false"; + }; + mountpoint = "/"; + + topology = { + type = "zfs_topology"; + vdev = [ + { + mode = "mirror"; + members = [ "x" "y" ]; + } + ]; + special = { + members = [ "z" ]; + }; + cache = "cache"; + }; + + datasets = { + # See examples/zfs.nix for more comprehensive usage. + zfs_fs = { + type = "zfs_fs"; + mountpoint = "/zfs_fs"; + options."com.sun:auto-snapshot" = "true"; + }; + }; + }; + }; + }; +} +