80 lines
1.7 KiB
Nix
80 lines
1.7 KiB
Nix
{ disks ? [ "/dev/sda" "/dev/sdb" ], ... }: {
|
|
disk = {
|
|
one = {
|
|
type = "disk";
|
|
device = builtins.elemAt disks 0;
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
boot = {
|
|
size = "1M";
|
|
type = "EF02";
|
|
};
|
|
ESP = {
|
|
size = "256M";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
};
|
|
};
|
|
mdadm = {
|
|
size = "100%";
|
|
content = {
|
|
type = "mdraid";
|
|
name = "raid1";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
two = {
|
|
type = "disk";
|
|
device = builtins.elemAt disks 1;
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
boot = {
|
|
size = "1M";
|
|
type = "EF02";
|
|
};
|
|
ESP = {
|
|
size = "256M";
|
|
type = "EF00";
|
|
};
|
|
mdadm = {
|
|
size = "100%";
|
|
content = {
|
|
type = "mdraid";
|
|
name = "raid1";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
mdadm = {
|
|
raid1 = {
|
|
type = "mdadm";
|
|
level = 1;
|
|
content = {
|
|
type = "luks";
|
|
name = "crypted";
|
|
extraOpenArgs = [ "--allow-discards" ];
|
|
settings = {
|
|
allowDiscards = true;
|
|
keyFile = "/tmp/secret.key";
|
|
};
|
|
additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
|
|
#initrdUnlock = true;
|
|
content = {
|
|
type = "filesystem";
|
|
format = "btrfs";
|
|
mountpoint = "/";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|