From 9f300cfecd6a209827b5aeab57d4ff3c3f88693c Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 26 Oct 2024 00:01:23 +0200 Subject: [PATCH] Delete partitions in descending order --- lib/modules/partition/disks.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/modules/partition/disks.nix b/lib/modules/partition/disks.nix index ba783123..a0dd0947 100644 --- a/lib/modules/partition/disks.nix +++ b/lib/modules/partition/disks.nix @@ -102,7 +102,9 @@ let cleanup = lib.strings.concatLines (builtins.map (partition: "${fdiskCommand "--delete ${diskVar} ${toString partition.index}"} || true") - (builtins.filter (_: !_.keepExisting) partitions)); + (lib.lists.sortOn + (partition: partition.index * -1) + (builtins.filter (_: !_.keepExisting) partitions))); fdiskCommands = lib.strings.concatLines (lib.optionals config.wipe [