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.
This commit is contained in:
lassulus committed 2022-09-02 11:14:58 +02:00
1 parent adf901d581
commit dcb0c42857
11 files changed
+1545 -534

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
{ pkgs ? (import <nixpkgs> { })
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
}:
makeDiskoTest {
disko-config = import ../example/complex.nix;
extraTestScript = ''
machine.succeed("test -b /dev/zroot/zfs_testvolume");
machine.succeed("test -b /dev/md/raid1p1");
machine.succeed("mountpoint /mnt");
machine.succeed("mountpoint /mnt/zfs_fs");
machine.succeed("mountpoint /mnt/zfs_legacy_fs");
machine.succeed("mountpoint /mnt/ext4onzfs");
machine.succeed("mountpoint /mnt/ext4_on_lvm");
'';
extraConfig = {
boot.kernelModules = [ "dm-raid" "dm-mirror" ];
};
}
+1 -1
View File
@@ -17,7 +17,7 @@
};
tsp-create = pkgs.writeScript "create" ((pkgs.callPackage ../. { }).create disko-config);
tsp-mount = pkgs.writeScript "mount" ((pkgs.callPackage ../. { }).mount disko-config);
num-disks = builtins.length (builtins.filter (x: builtins.match "vd." x == [ ]) (lib.attrNames disko-config.content));
num-disks = builtins.length (lib.attrNames disko-config.disk);
in
makeTest' {
name = "disko";