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

72 lines
1.9 KiB
Nix
Raw Normal View History

2023-12-10 15:56:40 +00:00
{disks ? ["/dev/sda"], ...}: {
2023-10-12 14:21:14 +00:00
disko.devices = {
disk = {
"one" = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "gpt";
partitions = {
"ESP" = {
2023-10-12 14:21:14 +00:00
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
"fmask=0077"
"dmask=0077"
2023-10-12 14:21:14 +00:00
];
};
};
"luks" = {
2023-10-12 14:21:14 +00:00
end = "-16G";
content = {
type = "luks";
name = "crypted";
extraOpenArgs = ["--allow-discards"];
2023-10-12 14:21:14 +00:00
passwordFile = "/tmp/secret.key"; # Interactive
content = {
type = "btrfs";
extraArgs = ["-f"];
2023-10-12 14:21:14 +00:00
mountpoint = "/btrfs";
subvolumes = {
"/@nix" = {
mountpoint = "/nix";
mountOptions = ["compress=zstd" "noatime"];
2023-10-12 14:21:14 +00:00
};
2023-12-10 15:42:07 +00:00
"/@persist" = {
mountpoint = "/persist";
mountOptions = ["compress=zstd" "noatime"];
};
2023-10-12 14:21:14 +00:00
};
};
};
};
"swap" = {
2023-10-12 14:21:14 +00:00
size = "100%";
content = {
type = "swap";
randomEncryption = true;
resumeDevice = true; # resume from hiberation from this device
};
};
};
};
};
};
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"size=2G"
"defaults"
"mode=755"
];
};
};
};
}