pkgs/den-http-get-updater: try evaluate urlLocation multiple times

This commit is contained in:
Wroclaw 2025-04-09 12:54:16 +02:00
parent 1cda1638c4
commit 80cb27a618

View file

@ -113,10 +113,21 @@ writeScript "den-http-get-updater" (''
nixUnpack = lib.optionalString unpack "--unpack";
nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\"";
in ''
nixUrlsResult=$(nix-instantiate --eval --json --strict \
"${prefetchUrlLocationShellEscape.file}" \
-A "${prefetchUrlLocationShellEscape.attrpath}"
)
for i in {{ 1..30 }}; do
nixUrlsResult=$(nix-instantiate --eval --json --strict \
"${prefetchUrlLocationShellEscape.file}" \
-A "${prefetchUrlLocationShellEscape.attrpath}"
)
if [[ "$?" == "0" ]]; then
break
elif [[ "$i" == 30 ]]; then
echo "error: prefetchUrlLocation failed - attempts exhausted" 1>&2
exit 1
fi
echo "prefetchUrlLocation failed (attempt $i)" 1>&2
sleep 2
done
urlsType=$(jq -rc 'type' <<< "$nixUrlsResult")
if [ "$urlsType" = "array" ]; then