2024-04-07 17:34:18 +00:00
|
|
|
{
|
|
|
|
diskSetup = {
|
|
|
|
device ? throw "Missing required argument device. (e.g. /dev/sda)",
|
|
|
|
swapCapacity ? throw "Missing required argument swapCapacity. (e.g. 16G)",
|
|
|
|
ssd ? false,
|
2024-04-08 19:15:33 +00:00
|
|
|
efi ? true,
|
2024-04-07 17:34:18 +00:00
|
|
|
...
|
|
|
|
}: {
|
|
|
|
disko.devices = {
|
|
|
|
disk.main = {
|
|
|
|
inherit device;
|
|
|
|
|
|
|
|
type = "disk";
|
|
|
|
content = {
|
|
|
|
type = "gpt";
|
2024-04-08 19:51:09 +00:00
|
|
|
partitions =
|
|
|
|
{
|
|
|
|
"luks" = {
|
|
|
|
size = "100%";
|
2024-04-07 17:34:18 +00:00
|
|
|
content = {
|
2024-04-08 19:51:09 +00:00
|
|
|
type = "luks";
|
|
|
|
name = "crypted";
|
|
|
|
settings.allowDiscards = true;
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "btrfs";
|
|
|
|
extraArgs = ["-f"];
|
|
|
|
subvolumes = {
|
|
|
|
"/root" = {
|
|
|
|
mountpoint = "/";
|
|
|
|
mountOptions =
|
|
|
|
[
|
|
|
|
"compress=zstd"
|
|
|
|
"noatime"
|
|
|
|
]
|
|
|
|
++ (
|
|
|
|
if ssd
|
|
|
|
then ["ssd"]
|
|
|
|
else []
|
|
|
|
);
|
|
|
|
};
|
|
|
|
"/persist" = {
|
|
|
|
mountpoint = "/persist";
|
|
|
|
mountOptions =
|
|
|
|
[
|
|
|
|
"compress=zstd"
|
|
|
|
"noatime"
|
|
|
|
]
|
|
|
|
++ (
|
|
|
|
if ssd
|
|
|
|
then ["ssd"]
|
|
|
|
else []
|
|
|
|
);
|
|
|
|
};
|
|
|
|
"/nix" = {
|
|
|
|
mountpoint = "/nix";
|
|
|
|
mountOptions =
|
|
|
|
[
|
|
|
|
"compress=zstd"
|
|
|
|
"noatime"
|
|
|
|
]
|
|
|
|
++ (
|
|
|
|
if ssd
|
|
|
|
then ["ssd"]
|
|
|
|
else []
|
|
|
|
);
|
|
|
|
};
|
|
|
|
"/swap" = {
|
|
|
|
mountpoint = "/.swapvol";
|
|
|
|
swap.swapfile.size = swapCapacity;
|
|
|
|
};
|
2024-04-07 17:34:18 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-04-08 19:51:09 +00:00
|
|
|
}
|
|
|
|
// (
|
|
|
|
if efi
|
|
|
|
then {
|
|
|
|
"esp" = {
|
|
|
|
size = "512M";
|
|
|
|
type = "EF00";
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "vfat";
|
|
|
|
mountpoint = "/boot";
|
|
|
|
mountOptions = ["umask=0077"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
"boot" = {
|
|
|
|
size = "512M";
|
|
|
|
type = "EF02";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
2024-04-07 17:34:18 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|