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/luks-lvm.nix | 130 +++++++++++++++++++++++++-------------------------- 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'example/luks-lvm.nix') diff --git a/example/luks-lvm.nix b/example/luks-lvm.nix index 22c029e..17e18a2 100644 --- a/example/luks-lvm.nix +++ b/example/luks-lvm.nix @@ -1,81 +1,81 @@ { - type = "devices"; - content = { + disk = { 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 = "/"; + type = "disk"; + device = "/dev/vdb"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + name = "ESP"; + # fs-type = "FAT32"; + start = "1MiB"; + end = "100MiB"; + bootable = true; content = { type = "filesystem"; - format = "ext4"; - mountpoint = "/"; + format = "vfat"; + mountpoint = "/boot"; options = [ "defaults" ]; }; - }; - home = { - type = "lvm_lv"; - size = "10M"; + } + { + type = "partition"; + name = "luks"; + start = "100MiB"; + end = "100%"; content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/home"; + type = "luks"; + name = "crypted"; + keyFile = "/tmp/secret.key"; + extraArgs = [ + "--hash sha512" + "--iter-time 5000" + ]; + content = { + type = "lvm_pv"; + vg = "pool"; + }; }; + } + ]; + }; + }; + }; + lvm_vg = { + pool = { + type = "lvm_vg"; + lvs = { + root = { + type = "lvm_lv"; + size = "100M"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + options = [ + "defaults" + ]; }; - raw = { - type = "lvm_lv"; - size = "10M"; - content = { - type = "noop"; - }; + }; + home = { + type = "lvm_lv"; + size = "10M"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/home"; }; }; + raw = { + type = "lvm_lv"; + size = "10M"; + }; + }; }; }; } -- cgit v1.2.3