nixos-config/hosts/i15/partitions.nix

54 lines
1.3 KiB
Nix
Raw Normal View History

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