Add disko

This commit is contained in:
Leonardo Eugênio 2023-02-24 11:59:17 -03:00
parent a48c51b920
commit 386fb53ba8
8 changed files with 77 additions and 13 deletions

53
hosts/i15/partitions.nix Normal file
View file

@ -0,0 +1,53 @@
{ 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; };
};
};
};
}
];
};
};
}