flake/nixos/profiles/common/opt-in/disko.nix

77 lines
1.9 KiB
Nix
Raw Normal View History

2024-01-17 10:40:06 +00:00
{disks ? ["/dev/sda"], ...}: let
mountOptions = ["defaults" "compress=zstd" "noatime"];
cryptSettings = {
allowDiscards = true;
bypassWorkqueues = true;
};
in {
2023-10-12 14:21:14 +00:00
disko.devices = {
disk = {
"one" = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "gpt";
partitions = {
2024-01-02 17:58:12 +00:00
"esp" = {
2023-10-12 14:21:14 +00:00
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
2024-01-13 07:20:06 +00:00
mountOptions = ["defaults" "umask=007"];
2023-10-12 14:21:14 +00:00
};
};
2024-01-17 10:40:06 +00:00
"cryptedroot" = {
2023-10-12 14:21:14 +00:00
end = "-16G";
content = {
type = "luks";
2024-01-17 10:40:06 +00:00
name = "cryptedroot";
settings = cryptSettings;
2023-10-12 14:21:14 +00:00
content = {
type = "btrfs";
2024-01-17 10:40:06 +00:00
subvolumes = {
2023-10-12 14:21:14 +00:00
"/@nix" = {
mountpoint = "/nix";
2024-01-13 07:20:06 +00:00
inherit mountOptions;
2023-10-12 14:21:14 +00:00
};
2023-12-10 15:42:07 +00:00
"/@persist" = {
mountpoint = "/persist";
2024-01-13 07:20:06 +00:00
inherit mountOptions;
2023-12-10 15:42:07 +00:00
};
2023-10-12 14:21:14 +00:00
};
};
};
};
2024-01-17 10:40:06 +00:00
"cryptedswap" = {
end = "-16G";
2023-10-12 14:21:14 +00:00
content = {
2024-01-17 10:40:06 +00:00
type = "luks";
name = "cryptedswap";
settings = cryptSettings;
content = {
type = "swap";
resumeDevice = true;
};
2023-10-12 14:21:14 +00:00
};
};
};
};
};
};
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
2024-01-02 17:58:12 +00:00
"size=2G"
2023-10-12 14:21:14 +00:00
"mode=755"
2024-01-02 17:58:12 +00:00
"nodev"
"nosuid"
2023-10-12 14:21:14 +00:00
];
};
};
};
}