Open jacobranson opened 7 months ago
After studying the code a little, I realized that the partition number is set by the variable = _index And so that the disk is not formatted, you need to use the mode = format
{
...
partitions = {
ESP = {
type = "EF00";
size = "500M";
_index = 4;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
_index = 5;
...
}
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode format /tmp/disk-config.nix
I have that such a feature becomes to complex to implement with just the nixos module system and shell scripts.
it should basically work by replicating your current disk layout in disko (using priority for the order of the partitons) and then just running the format script manually (not the disko one, as that one zaps your disks) the format script should not nuke your table if it already exists. so in theory it should just work.
I think it would be beneficial if there was a way to mark partitions as "ignored", meaning Disko won't touch them in any way. For M1 Macs, there are two partitions that cannot be deleted without rendering the machine unbootable, those being
iBootSystemContainer
andRecoveryOSContainer
, like shown below.Alternatively, if there is already a mechanism for something like this, perhaps the examples directory can be updated to include a M1 Mac example configuration.