94 lines
2.2 KiB
Nix
94 lines
2.2 KiB
Nix
{ disks ? [ "/dev/vda" ], ... }: {
|
|
disko.devices = {
|
|
disk = {
|
|
vda = {
|
|
type = "disk";
|
|
device = builtins.elemAt disks 0;
|
|
content = {
|
|
type = "table";
|
|
format = "gpt";
|
|
partitions = [
|
|
{
|
|
name = "boot";
|
|
start = "0";
|
|
end = "1M";
|
|
part-type = "primary";
|
|
flags = [ "bios_grub" ];
|
|
}
|
|
{
|
|
name = "ESP";
|
|
start = "1MiB";
|
|
end = "265MiB";
|
|
bootable = true;
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
mountOptions = [
|
|
"defaults"
|
|
];
|
|
};
|
|
}
|
|
{
|
|
name = "luks";
|
|
start = "265MiB";
|
|
end = "100%";
|
|
content = {
|
|
type = "luks";
|
|
name = "crypted";
|
|
extraOpenArgs = [ "--allow-discards" ];
|
|
# 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";
|
|
nix = {
|
|
persistent = {
|
|
size = "100%";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "ext4";
|
|
mountpoint = "/nix";
|
|
mountOptions = [
|
|
"defaults"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
nodev = {
|
|
"/" = {
|
|
fsType = "tmpfs";
|
|
mountOptions = [
|
|
"size=2G"
|
|
"defaults"
|
|
"mode=755"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
fileSystems."/var/log" =
|
|
{
|
|
device = "/nix/persistent/varlog";
|
|
fsType = "bind";
|
|
neededForBoot = true;
|
|
};
|
|
fileSystems."/persistent" =
|
|
{
|
|
device = "/nix/persistent";
|
|
fsType = "bind";
|
|
neededForBoot = true;
|
|
};
|
|
}
|