nixos-config/hosts/i15/partitions.nix

74 lines
1.6 KiB
Nix
Raw Permalink Normal View History

2024-06-13 22:01:35 -03:00
{
disks ? [ "/dev/sda" ],
...
}:
2023-02-24 11:59:17 -03:00
let
2024-06-13 22:01:35 -03:00
btrfs_options = [
"compress=zstd:3"
"noatime"
];
2023-02-24 11:59:17 -03:00
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";
2024-06-13 22:01:35 -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";
2024-06-13 22:01:35 -03:00
extraArgs = [
"--label"
"ROOT_I15"
];
subvolumes =
let
mountOptions = btrfs_options;
in
{
"/home" = {
inherit mountOptions;
};
"/nixos" = {
inherit mountOptions;
mountpoint = "/";
};
"/swap" = {
inherit mountOptions;
};
2023-02-24 11:59:17 -03:00
};
2023-02-23 19:18:15 -03:00
};
};
}
];
};
};
}