From dcb0c42857a2ada8754d4514d4b8c4c1d67ab3f5 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 29 Aug 2022 11:45:19 +0200 Subject: reimplement disko using the nixos type system This should make the code cleaner, more robust and errors should be clearer. we also changed the configuration format a bit. --- example/lvm-raid.nix | 112 +++++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 52 deletions(-) (limited to 'example/lvm-raid.nix') diff --git a/example/lvm-raid.nix b/example/lvm-raid.nix index 48930ec..3c5ee69 100644 --- a/example/lvm-raid.nix +++ b/example/lvm-raid.nix @@ -1,66 +1,74 @@ { - type = "devices"; - content = { + disk = { vdb = { - type = "table"; - format = "gpt"; - partitions = [ - { - type = "partition"; - part-type = "primary"; - start = "0%"; - end = "100%"; - content = { - type = "lvm_pv"; - vg = "pool"; - }; - } - ]; + type = "disk"; + device = "/dev/vdb"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + name = "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"; - }; - } - ]; + type = "disk"; + device = "/dev/vdc"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + name = "primary"; + start = "0%"; + end = "100%"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + } + ]; + }; }; + }; + lvm_vg = { pool = { type = "lvm_vg"; - lvs = { - root = { - type = "lvm_lv"; - size = "100M"; + lvs = { + root = { + type = "lvm_lv"; + size = "100M"; + lvm_type = "mirror"; + content = { + type = "filesystem"; + format = "ext4"; mountpoint = "/"; - lvm_type = "mirror"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - options = [ - "defaults" - ]; - }; + options = [ + "defaults" + ]; }; - home = { - type = "lvm_lv"; - size = "10M"; - lvm_type = "raid0"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/home"; - }; + }; + home = { + type = "lvm_lv"; + size = "10M"; + lvm_type = "raid0"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/home"; }; }; + }; }; }; } -- cgit v1.2.3