flake/hosts/aristotle/disko.nix
2024-07-10 07:50:22 +08:00

78 lines
1.9 KiB
Nix

let
disks = ["/dev/nvme0n1"];
# compress-force: https://t.me/archlinuxcn_group/3054167
mountOptions = ["defaults" "compress-force=zstd" "noatime"];
cryptSettings = {
allowDiscards = true;
bypassWorkqueues = true;
};
in {
disko.devices = {
disk = {
"one" = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "gpt";
partitions = {
"esp" = {
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["defaults" "umask=007"];
};
};
"cryptedroot" = {
end = "-16G";
content = {
type = "luks";
name = "cryptedroot";
settings = cryptSettings;
content = {
type = "btrfs";
subvolumes = {
"/@nix" = {
mountpoint = "/nix";
inherit mountOptions;
};
"/@persist" = {
mountpoint = "/persist";
inherit mountOptions;
};
};
};
};
};
"cryptedswap" = {
end = "-16G";
content = {
type = "luks";
name = "cryptedswap";
settings = cryptSettings;
content = {
type = "swap";
resumeDevice = true;
};
};
};
};
};
};
};
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=2G"
"mode=755"
"nodev"
"nosuid"
];
};
};
};
}