This commit is contained in:
Kristian Krsnik 2024-04-08 22:09:31 +02:00
parent 9e2042ae3a
commit 3656d672c4
Signed by: Kristian
GPG Key ID: FD1330AC9F909E85
2 changed files with 70 additions and 79 deletions

View File

@ -3,7 +3,6 @@
device ? throw "Missing required argument device. (e.g. /dev/sda)", device ? throw "Missing required argument device. (e.g. /dev/sda)",
swapCapacity ? throw "Missing required argument swapCapacity. (e.g. 16G)", swapCapacity ? throw "Missing required argument swapCapacity. (e.g. 16G)",
ssd ? false, ssd ? false,
efi ? true,
... ...
}: { }: {
disko.devices = { disko.devices = {
@ -13,88 +12,81 @@
type = "disk"; type = "disk";
content = { content = {
type = "gpt"; type = "gpt";
partitions = partitions = {
{ "boot" = {
"luks" = { size = "512M";
size = "100%"; type = "EF02";
content = { };
type = "luks"; "esp" = {
name = "crypted"; size = "512M";
settings.allowDiscards = true; type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["umask=0077"];
};
};
content = { "luks" = {
type = "btrfs"; size = "100%";
extraArgs = ["-f"]; content = {
subvolumes = { type = "luks";
"/root" = { name = "crypted";
mountpoint = "/"; settings.allowDiscards = true;
mountOptions =
[ content = {
"compress=zstd" type = "btrfs";
"noatime" extraArgs = ["-f"];
] subvolumes = {
++ ( "/root" = {
if ssd mountpoint = "/";
then ["ssd"] mountOptions =
else [] [
); "compress=zstd"
}; "noatime"
"/persist" = { ]
mountpoint = "/persist"; ++ (
mountOptions = if ssd
[ then ["ssd"]
"compress=zstd" else []
"noatime" );
] };
++ ( "/persist" = {
if ssd mountpoint = "/persist";
then ["ssd"] mountOptions =
else [] [
); "compress=zstd"
}; "noatime"
"/nix" = { ]
mountpoint = "/nix"; ++ (
mountOptions = if ssd
[ then ["ssd"]
"compress=zstd" else []
"noatime" );
] };
++ ( "/nix" = {
if ssd mountpoint = "/nix";
then ["ssd"] mountOptions =
else [] [
); "compress=zstd"
}; "noatime"
"/swap" = { ]
mountpoint = "/.swapvol"; ++ (
swap.swapfile.size = swapCapacity; if ssd
}; then ["ssd"]
else []
);
};
"/swap" = {
mountpoint = "/.swapvol";
swap.swapfile.size = swapCapacity;
}; };
}; };
}; };
}; };
} };
// ( };
if efi
then {
"esp" = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["umask=0077"];
};
};
}
else {
"boot" = {
size = "512M";
type = "EF02";
};
}
);
}; };
}; };
}; };

View File

@ -3,5 +3,4 @@ libs.diskSetup {
device = "/dev/sda"; device = "/dev/sda";
ssd = true; ssd = true;
swapCapacity = "2G"; swapCapacity = "2G";
efi = true;
} }