nixos-config/hosts/i15/partitions.nix
Leonardo Eugênio b1c96cb075 Add disko
2024-06-13 21:21:04 -03:00

54 lines
1.3 KiB
Nix

{ disks ? [ "/dev/sda" ], ... }:
let
btrfs_options = [ "compress=zstd:3" "noatime" ];
in
{
disk.sda = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "table";
format = "gpt";
partitions = [
{
type = "partition";
name = "NIX_BOOT";
start = "1MiB";
end = "300MiB";
bootable = true;
content = {
type = "filesystem";
extraArgs = [ "-n" "BOOT_I15" ];
format = "vfat";
mountpoint = "/boot";
# options = [ "defaults" ];
};
}
{
type = "partition";
name = "CRYPT_I15";
start = "300MiB";
end = "100%";
content = {
type = "luks";
name = "main";
keyFile = "/tmp/secret.key";
content = {
type = "btrfs";
extraArgs = [ "--label" "ROOT_I15" ];
subvolumes = let mountOptions = btrfs_options; in {
"/home" = { inherit mountOptions; };
"/nixos" = {
inherit mountOptions;
mountpoint = "/";
};
"/swap" = { inherit mountOptions; };
};
};
};
}
];
};
};
}