mirror of
https://github.com/nix-community/disko.git
synced 2024-11-04 05:44:29 +03:00
add test for lvm example
This commit is contained in:
parent
3e48d1fd85
commit
65bd5a97f8
@ -1,47 +1,12 @@
|
||||
# usage: nix-instantiate --eval --json --strict example/config.nix | jq .
|
||||
{
|
||||
type = "devices";
|
||||
content = {
|
||||
sda = {
|
||||
type = "table";
|
||||
format = "gpt";
|
||||
partitions = [
|
||||
{
|
||||
type = "partition";
|
||||
part-type = "ESP";
|
||||
start = "1MiB";
|
||||
end = "1024MiB";
|
||||
fs-type = "fat32";
|
||||
bootable = true;
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
}
|
||||
{
|
||||
type = "partition";
|
||||
part-type = "primary";
|
||||
start = "1024MiB";
|
||||
end = "100%";
|
||||
flags = [ "bios_grub" ];
|
||||
content = {
|
||||
type = "luks";
|
||||
algo = "aes-xts...";
|
||||
name = "crypted";
|
||||
keyfile = "/tmp/secret.key";
|
||||
extraArgs = [
|
||||
"--hash sha512"
|
||||
"--iter-time 5000"
|
||||
];
|
||||
content = {
|
||||
type = "lvm";
|
||||
name = "pool";
|
||||
lvm_vg = {
|
||||
pool = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
type = "lv";
|
||||
size = "10G";
|
||||
mountpoint = "/";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
@ -60,8 +25,50 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
disk = {
|
||||
sda = {
|
||||
device = "/dev/sda";
|
||||
content = {
|
||||
type = "table";
|
||||
format = "gpt";
|
||||
partitions = [
|
||||
{
|
||||
name = "boot";
|
||||
type = "partition";
|
||||
part-type = "ESP";
|
||||
start = "1MiB";
|
||||
end = "1024MiB";
|
||||
fs-type = "fat32";
|
||||
bootable = true;
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "crypt_root";
|
||||
type = "partition";
|
||||
part-type = "primary";
|
||||
start = "1024MiB";
|
||||
end = "100%";
|
||||
flags = ["bios_grub"];
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "crypted";
|
||||
keyFile = "/tmp/secret.key";
|
||||
extraArgs = [
|
||||
"--hash sha512"
|
||||
"--iter-time 5000"
|
||||
];
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "pool";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -4,6 +4,14 @@
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
makeDiskoTest = (pkgs.callPackage ./lib.nix { inherit makeTest; }).makeDiskoTest;
|
||||
|
||||
evalTest = name: configFile: let
|
||||
disko-config = import configFile;
|
||||
in {
|
||||
"${name}-tsp-create" = pkgs.writeScript "create" ((pkgs.callPackage ../. { }).create disko-config);
|
||||
"${name}-tsp-mount" = pkgs.writeScript "mount" ((pkgs.callPackage ../. { }).mount disko-config);
|
||||
};
|
||||
|
||||
allTestFilenames =
|
||||
builtins.map (lib.removeSuffix ".nix") (
|
||||
builtins.filter
|
||||
@ -11,6 +19,7 @@ let
|
||||
(lib.attrNames (builtins.readDir ./.))
|
||||
);
|
||||
|
||||
allTests = lib.genAttrs (allTestFilenames) (test: import (./. + "/${test}.nix") { inherit makeDiskoTest; });
|
||||
allTests = lib.genAttrs (allTestFilenames) (test: import (./. + "/${test}.nix") { inherit makeDiskoTest; }) //
|
||||
evalTest "lvm-luks-example" ../example/config.nix;
|
||||
in
|
||||
allTests
|
||||
|
Loading…
Reference in New Issue
Block a user