mirror of
https://github.com/nix-community/disko
synced 2024-11-10 06:14:14 +00:00
tests: enable swraid, add luks-on-mdadm test
This commit is contained in:
parent
5a9bfa9fa6
commit
491e567d47
3 changed files with 78 additions and 1 deletions
58
example/luks-on-mdadm.nix
Normal file
58
example/luks-on-mdadm.nix
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
disko.devices.disk = lib.genAttrs [ "a" "b" ] (name: {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/sd${name}";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "1M";
|
||||||
|
type = "EF02"; # for grub MBR
|
||||||
|
};
|
||||||
|
ESP = {
|
||||||
|
size = "100M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "mdraid";
|
||||||
|
name = "boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
mdadm = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "mdraid";
|
||||||
|
name = "raid1";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
disko.devices.mdadm = {
|
||||||
|
boot = {
|
||||||
|
type = "mdadm";
|
||||||
|
level = 1;
|
||||||
|
metadata = "1.0";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
raid1 = {
|
||||||
|
type = "mdadm";
|
||||||
|
level = 1;
|
||||||
|
content = {
|
||||||
|
type = "luks";
|
||||||
|
name = "crypted";
|
||||||
|
settings.keyFile = "/tmp/secret.key";
|
||||||
|
content= {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -167,11 +167,14 @@ let
|
||||||
networking.hostId = "8425e349";
|
networking.hostId = "8425e349";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
boot.initrd.services.swraid.enable = true;
|
||||||
|
systemd.services.mdmonitor.enable = false; # silence some weird warnings
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
pkgs.jq
|
pkgs.jq
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
# speed-up eval
|
# speed-up eval
|
||||||
documentation.enable = false;
|
documentation.enable = false;
|
||||||
|
|
||||||
|
|
16
tests/luks-on-mdadm.nix
Normal file
16
tests/luks-on-mdadm.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{ pkgs ? import <nixpkgs> { }
|
||||||
|
, diskoLib ? pkgs.callPackage ../lib { }
|
||||||
|
}:
|
||||||
|
diskoLib.testLib.makeDiskoTest {
|
||||||
|
inherit pkgs;
|
||||||
|
name = "luks-on-mdadm";
|
||||||
|
disko-config = ../example/luks-on-mdadm.nix;
|
||||||
|
extraTestScript = ''
|
||||||
|
machine.succeed("test -b /dev/md/raid1");
|
||||||
|
machine.succeed("mountpoint /");
|
||||||
|
'';
|
||||||
|
extraSystemConfig = {
|
||||||
|
# sadly systemd-boot fails to install to a raid /boot device
|
||||||
|
boot.loader.systemd-boot.enable = false;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue