summaryrefslogtreecommitdiffstats
path: root/example
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2022-08-26 14:59:28 +0100
committerGitHub <noreply@github.com>2022-08-26 14:59:28 +0100
commitadf901d58155ca268d15351fff164d3ef38a0890 (patch)
treec6057a3d362e06742073b35d4c11db7ee9a0a820 /example
parent6b0b20da18cdffd09f04faee7128c557bcb9f054 (diff)
parent9bb4aec9640cbc30e241c267158e506278862b5e (diff)
Merge pull request #27 from nix-community/zfs
zfs, lvm raid, btrfs subvolumes support & some fixups
Diffstat (limited to 'example')
-rw-r--r--example/btrfs-subvolumes.nix26
-rw-r--r--example/luks-lvm.nix81
-rw-r--r--example/lvm-raid.nix66
-rw-r--r--example/mdadm.nix (renamed from example/raid.nix)1
-rw-r--r--example/zfs-over-legacy.nix42
-rw-r--r--example/zfs.nix53
6 files changed, 268 insertions, 1 deletions
diff --git a/example/btrfs-subvolumes.nix b/example/btrfs-subvolumes.nix
new file mode 100644
index 0000000..0124c86
--- /dev/null
+++ b/example/btrfs-subvolumes.nix
@@ -0,0 +1,26 @@
+{
+ type = "devices";
+ content = {
+ vdb = {
+ type = "table";
+ format = "gpt";
+ partitions = [
+ {
+ type = "partition";
+ part-type = "primary";
+ start = "0%";
+ end = "100%";
+ content = {
+ type = "btrfs";
+ mountpoint = "/";
+ subvolumes = [
+ "/home"
+ "/test"
+ ];
+ };
+ }
+ ];
+ };
+ };
+}
+
diff --git a/example/luks-lvm.nix b/example/luks-lvm.nix
new file mode 100644
index 0000000..22c029e
--- /dev/null
+++ b/example/luks-lvm.nix
@@ -0,0 +1,81 @@
+{
+ type = "devices";
+ content = {
+ vdb = {
+ type = "table";
+ format = "gpt";
+ partitions = [
+ {
+ type = "partition";
+ part-type = "ESP";
+ start = "1MiB";
+ end = "100MiB";
+ fs-type = "FAT32";
+ bootable = true;
+ content = {
+ type = "filesystem";
+ format = "vfat";
+ mountpoint = "/boot";
+ options = [
+ "defaults"
+ ];
+ };
+ }
+ {
+ type = "partition";
+ part-type = "primary";
+ start = "100MiB";
+ end = "100%";
+ content = {
+ type = "luks";
+ algo = "aes-xts...";
+ name = "crypted";
+ keyfile = "/tmp/secret.key";
+ extraArgs = [
+ "--hash sha512"
+ "--iter-time 5000"
+ ];
+ content = {
+ type = "lvm_pv";
+ vg = "pool";
+ };
+ };
+ }
+ ];
+ };
+ pool = {
+ type = "lvm_vg";
+ lvs = {
+ root = {
+ type = "lvm_lv";
+ size = "100M";
+ mountpoint = "/";
+ content = {
+ type = "filesystem";
+ format = "ext4";
+ mountpoint = "/";
+ options = [
+ "defaults"
+ ];
+ };
+ };
+ home = {
+ type = "lvm_lv";
+ size = "10M";
+ content = {
+ type = "filesystem";
+ format = "ext4";
+ mountpoint = "/home";
+ };
+ };
+ raw = {
+ type = "lvm_lv";
+ size = "10M";
+ content = {
+ type = "noop";
+ };
+ };
+ };
+ };
+ };
+}
diff --git a/example/lvm-raid.nix b/example/lvm-raid.nix
new file mode 100644
index 0000000..48930ec
--- /dev/null
+++ b/example/lvm-raid.nix
@@ -0,0 +1,66 @@
+{
+ type = "devices";
+ content = {
+ vdb = {
+ type = "table";
+ format = "gpt";
+ partitions = [
+ {
+ type = "partition";
+ part-type = "primary";
+ start = "0%";
+ end = "100%";
+ content = {
+ type = "lvm_pv";
+ vg = "pool";
+ };
+ }
+ ];
+ };
+ vdc = {
+ type = "table";
+ format = "gpt";
+ partitions = [
+ {
+ type = "partition";
+ part-type = "primary";
+ start = "0%";
+ end = "100%";
+ content = {
+ type = "lvm_pv";
+ vg = "pool";
+ };
+ }
+ ];
+ };
+ pool = {
+ type = "lvm_vg";
+ lvs = {
+ root = {
+ type = "lvm_lv";
+ size = "100M";
+ mountpoint = "/";
+ lvm_type = "mirror";
+ content = {
+ type = "filesystem";
+ format = "ext4";
+ mountpoint = "/";
+ options = [
+ "defaults"
+ ];
+ };
+ };
+ home = {
+ type = "lvm_lv";
+ size = "10M";
+ lvm_type = "raid0";
+ content = {
+ type = "filesystem";
+ format = "ext4";
+ mountpoint = "/home";
+ };
+ };
+ };
+ };
+ };
+}
diff --git a/example/raid.nix b/example/mdadm.nix
index 490ea01..cb0ad91 100644
--- a/example/raid.nix
+++ b/example/mdadm.nix
@@ -53,7 +53,6 @@
};
}
];
-
};
};
};
diff --git a/example/zfs-over-legacy.nix b/example/zfs-over-legacy.nix
new file mode 100644
index 0000000..8f5a8bc
--- /dev/null
+++ b/example/zfs-over-legacy.nix
@@ -0,0 +1,42 @@
+{
+ type = "devices";
+ content = {
+ vdb = {
+ type = "table";
+ format = "gpt";
+ partitions = [
+ {
+ type = "partition";
+ # leave space for the grub aka BIOS boot
+ start = "0%";
+ end = "100%";
+ part-type = "primary";
+ bootable = true;
+ content = {
+ type = "filesystem";
+ format = "ext4";
+ mountpoint = "/";
+ };
+ }
+ ];
+ };
+ vdc = {
+ type = "zfs";
+ pool = "zroot";
+ };
+ zroot = {
+ type = "zpool";
+ mountpoint = "/";
+
+ datasets = [
+ {
+ type = "zfs_filesystem";
+ name = "zfs_fs";
+ mountpoint = "/zfs_fs";
+ options."com.sun:auto-snapshot" = "true";
+ }
+ ];
+ };
+ };
+}
+
diff --git a/example/zfs.nix b/example/zfs.nix
new file mode 100644
index 0000000..60e4700
--- /dev/null
+++ b/example/zfs.nix
@@ -0,0 +1,53 @@
+{
+ type = "devices";
+ content = {
+ vdb = {
+ type = "zfs";
+ pool = "zroot";
+ };
+ vdc = {
+ type = "zfs";
+ pool = "zroot";
+ };
+ zroot = {
+ type = "zpool";
+ mode = "mirror";
+ rootFsOptions = {
+ compression = "lz4";
+ "com.sun:auto-snapshot" = "false";
+ };
+ mountpoint = "/";
+
+ datasets = [
+ {
+ type = "zfs_filesystem";
+ name = "zfs_fs";
+ mountpoint = "/zfs_fs";
+ options."com.sun:auto-snapshot" = "true";
+ }
+ {
+ type = "zfs_filesystem";
+ name = "zfs_unmounted_fs";
+ options.mountpoint = "none";
+ }
+ {
+ type = "zfs_filesystem";
+ name = "zfs_legacy_fs";
+ options.mountpoint = "legacy";
+ mountpoint = "/zfs_legacy_fs";
+ }
+ {
+ type = "zfs_volume";
+ name = "zfs_testvolume";
+ size = "10M";
+ content = {
+ type = "filesystem";
+ format = "ext4";
+ mountpoint = "/ext4onzfs";
+ };
+ }
+ ];
+ };
+ };
+}
+