nix-v0/disko.nix
2024-10-26 00:10:48 -05:00

96 lines
2 KiB
Nix

{
device ? throw "Set this to your disk device, e.g. /dev/sda",
...
}:
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=8G"
"mode=755"
];
};
};
disk.main = {
type = "disk";
inherit device;
content = {
type = "gpt";
partitions = {
boot = {
name = "boot";
size = "1M";
type = "EF02";
};
esp = {
priority = 1;
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
"umask=0077"
];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
settings = {
allowDiscards = true;
};
content = {
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
size = "100%FREE";
content = {
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/persist" = {
mountOptions = ["subvol=persist" "compress=zstd" "noatime"];
mountpoint = "/persist";
};
"/nix" = {
mountOptions = ["subvol=nix" "compress=zstd" "noatime"];
mountpoint = "/nix";
};
"/swap" = {
mountpoint = "/swap";
mountOptions = ["noatime"];
swap.swapfile.size = "108G";
};
};
};
};
};
};
};
};
}