Skip to content

Instantly share code, notes, and snippets.

@serpent213
Created August 23, 2023 12:44
Show Gist options
  • Save serpent213/59b35f52079908f3061c682786bff038 to your computer and use it in GitHub Desktop.
Save serpent213/59b35f52079908f3061c682786bff038 to your computer and use it in GitHub Desktop.
Nix disko config for Hetzner dedicated
# disko config for Hetzner dedicated
# matching grub config:
#
# boot.loader.grub = {
# devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ];
# efiSupport = true;
# efiInstallAsRemovable = true;
# };
{ lib, disks ? [ "/dev/nvme0n1" "/dev/nvme1n1" ], ... }: {
disk = lib.genAttrs disks (dev: {
device = dev;
type = "disk";
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "boot";
start = "0";
end = "1MiB";
part-type = "primary";
flags = ["bios_grub"];
}
{
name = "ESP";
start = "1MiB";
end = "385MiB";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = if dev == "/dev/nvme0n1" then "/boot" else null;
};
}
{
name = "tank";
start = "385MiB";
end = "100%";
content = {
type = "zfs";
pool = "tank";
};
}
];
};
});
zpool = {
tank = {
type = "zpool";
mode = "mirror";
options = {
ashift = "12";
autotrim = "on";
};
rootFsOptions = {
acltype = "posixacl";
canmount = "off";
compression = "zstd";
dnodesize = "auto";
normalization = "formD";
relatime = "on";
xattr = "sa";
};
datasets = {
root = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/";
};
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment