diff --git a/lib/modules/partition/disks.nix b/lib/modules/partition/disks.nix index 4c19cf6e..6b214740 100644 --- a/lib/modules/partition/disks.nix +++ b/lib/modules/partition/disks.nix @@ -8,6 +8,7 @@ fs = import ./fs.nix; diskListVarName = "myDisks"; + probeScript = "partprobe 2> /dev/null || true"; isSwap = partition: builtins.elem partition.type [fs.swap 19]; mkDiskType = osDisk: types.submodule ( @@ -136,14 +137,7 @@ create = lib.strings.concatLines [ (appendScript "${toString index}: \"$(${sizeOption})\" type=${mkType type}") - # Wait for partition to be detected - ''echo "Waiting for ${partVar} to appear..."'' - '' - while true; - do - [ -b ${partVar} ] && break; - done; - '' + probeScript "sudo ${formatScripts.${format}}" ]; @@ -329,13 +323,7 @@ mountScript = lib.strings.concatLines ( builtins.concatMap (_: [ - ''echo "Waiting for "${lib.strings.escapeShellArg (partPath _)}" to appear..."'' - '' - while true; - do - [ -b ${lib.strings.escapeShellArg (partPath _)} ] && break - done - '' + probeScript (builtins.concatStringsSep " " [ "sudo" "mount" @@ -351,7 +339,10 @@ swapScript = lib.strings.concatLines ( builtins.map - (_: "sudo swapon ${partPath _}") + (_: '' + ${probeScript} + sudo swapon ${partPath _} + '') (builtins.filter (_: _.useSwap) partitions)); in lib.strings.concatLines ( (builtins.map (_: _.deviceScript) disks) ++ lib.optionals ((builtins.length disks) > 0) [