disko/example/luks-lvm.nix

77 lines
1.9 KiB
Nix
Raw Normal View History

2022-10-21 12:43:55 +00:00
{ disks ? [ "/dev/vdb" ], ... }: {
disko.devices = {
disk = {
vdb = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "ESP";
start = "1MiB";
end = "100MiB";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
}
{
name = "luks";
start = "100MiB";
end = "100%";
content = {
type = "luks";
name = "crypted";
extraOpenArgs = [ "--allow-discards" ];
2023-04-30 11:59:54 +00:00
# if you want to use the key for interactive login be sure there is no trailing newline
# for example use `echo -n "password" > /tmp/secret.key`
keyFile = "/tmp/secret.key";
content = {
type = "lvm_pv";
vg = "pool";
};
};
}
];
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
size = "100M";
2022-08-25 16:36:56 +00:00
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [
2022-08-25 16:36:56 +00:00
"defaults"
];
};
};
home = {
size = "10M";
2022-08-25 16:36:56 +00:00
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/home";
2022-08-25 16:36:56 +00:00
};
};
raw = {
size = "10M";
2022-08-25 16:36:56 +00:00
};
};
};
2022-08-25 16:36:56 +00:00
};
};
}