From ae80b428f053c1c3da93597f6b36d3797927ec64 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 22 Jun 2024 21:52:20 +0200 Subject: [PATCH] Format and label disks properly --- lib/modules/partition.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/modules/partition.nix b/lib/modules/partition.nix index 885c92e7..6949e9ff 100644 --- a/lib/modules/partition.nix +++ b/lib/modules/partition.nix @@ -129,8 +129,15 @@ (if keepExisting then fallback else create) ''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"'' ''local ${partVarName}="$diskPath-part${toString index}"'' - formatScripts.${format} - (labelScripts.${format} label) + # Wait for partition to be detected + '' + while true; + do + [ -b ${partVar} ] && break; + done; + '' + "sudo ${formatScripts.${format}}" + "sudo ${labelScripts.${format} label}" ]) partitions) );