disko/example/luks-lvm.nix

80 lines
1.7 KiB
Nix
Raw Normal View History

2022-10-21 12:43:55 +00:00
{ disks ? [ "/dev/vdb" ], ... }: {
disk = {
vdb = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "table";
format = "gpt";
partitions = [
{
type = "partition";
name = "ESP";
start = "1MiB";
end = "100MiB";
bootable = true;
2022-08-25 16:36:56 +00:00
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
2022-08-25 16:36:56 +00:00
options = [
"defaults"
];
};
}
{
type = "partition";
name = "luks";
start = "100MiB";
end = "100%";
2022-08-25 16:36:56 +00:00
content = {
type = "luks";
name = "crypted";
keyFile = "/tmp/secret.key";
extraArgs = [
"--hash sha512"
];
content = {
type = "lvm_pv";
vg = "pool";
};
2022-08-25 16:36:56 +00:00
};
}
];
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
type = "lvm_lv";
size = "100M";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
options = [
"defaults"
];
2022-08-25 16:36:56 +00:00
};
};
home = {
type = "lvm_lv";
size = "10M";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/home";
2022-08-25 16:36:56 +00:00
};
};
raw = {
type = "lvm_lv";
size = "10M";
};
};
2022-08-25 16:36:56 +00:00
};
};
}