disko/example/with-lib.nix

36 lines
838 B
Nix
Raw Normal View History

2022-10-21 12:43:55 +00:00
# Example to create a bios compatible gpt partition
{ disks ? [ "/dev/vdb" ], lib, ... }: {
2022-12-01 19:10:58 +00:00
disk = lib.genAttrs [ (lib.head disks) ] (device: {
2022-10-21 12:43:55 +00:00
device = device;
type = "disk";
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "boot";
type = "partition";
start = "0";
end = "1M";
part-type = "primary";
flags = ["bios_grub"];
}
{
name = "root";
type = "partition";
# leave space for the grub aka BIOS boot
start = "1M";
end = "100%";
part-type = "primary";
bootable = true;
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
}
];
};
2022-12-01 19:10:58 +00:00
});
2022-10-21 12:43:55 +00:00
}