2023-05-22 15:09:04 +02:00
|
|
|
_:
|
|
|
|
|
|
|
|
let
|
|
|
|
luksName = "mainfs";
|
2023-05-12 03:22:09 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
boot.initrd.luks.devices.${luksName} = {
|
|
|
|
keyFile = "/dev/zero";
|
|
|
|
keyFileSize = 1;
|
|
|
|
};
|
2023-05-12 02:59:03 +02:00
|
|
|
disko.devices = {
|
|
|
|
disk = {
|
|
|
|
vdb = {
|
|
|
|
device = "/dev/vdb";
|
|
|
|
type = "disk";
|
|
|
|
content = {
|
|
|
|
type = "table";
|
|
|
|
format = "gpt";
|
|
|
|
partitions = [
|
|
|
|
{
|
|
|
|
name = "ESP";
|
|
|
|
start = "1MiB";
|
|
|
|
end = "512MiB";
|
|
|
|
fs-type = "fat32";
|
|
|
|
bootable = true;
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "vfat";
|
|
|
|
mountpoint = "/boot";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "luks";
|
|
|
|
start = "512MiB";
|
|
|
|
end = "-4GiB";
|
|
|
|
content = rec {
|
2023-05-22 15:09:04 +02:00
|
|
|
type = "luks";
|
2023-05-12 03:22:09 +02:00
|
|
|
name = luksName;
|
2023-05-12 02:59:03 +02:00
|
|
|
extraOpenArgs = [ "--keyfile-size=1" ];
|
|
|
|
extraFormatArgs = extraOpenArgs;
|
|
|
|
keyFile = "/dev/zero";
|
|
|
|
content = {
|
|
|
|
type = "btrfs";
|
|
|
|
mountpoint = "/mnt/btrfs-root";
|
|
|
|
subvolumes = {
|
|
|
|
"/rootfs" = {
|
|
|
|
mountpoint = "/";
|
|
|
|
mountOptions = [ "compress=zstd" ];
|
|
|
|
};
|
|
|
|
"/home" = {
|
|
|
|
mountOptions = [ "compress=zstd" ];
|
|
|
|
mountpoint = "/home";
|
|
|
|
};
|
|
|
|
"/var-log" = {
|
|
|
|
mountOptions = [ "compress=zstd" ];
|
|
|
|
mountpoint = "/var/log";
|
|
|
|
};
|
|
|
|
"/nix" = {
|
2024-02-02 10:51:31 +01:00
|
|
|
mountOptions = [
|
|
|
|
"noatime"
|
|
|
|
"compress=zstd"
|
|
|
|
];
|
2023-05-12 02:59:03 +02:00
|
|
|
mountpoint = "/nix";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "swap";
|
|
|
|
start = "-4GiB";
|
|
|
|
end = "100%";
|
|
|
|
content = {
|
|
|
|
type = "swap";
|
|
|
|
randomEncryption = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|