nuget-to-nix: generate SRI hash instead of sha256
This commit is contained in:
@@ -65,11 +65,11 @@ for package in *; do
|
||||
for source in "${remote_sources[@]}"; do
|
||||
url="${base_addresses[$source]}$package/$version/$package.$version.nupkg"
|
||||
if [[ "$source" == "$used_source" ]]; then
|
||||
sha256="$(nix-hash --type sha256 --flat --base32 "$version/$package.$version".nupkg)"
|
||||
hash="$(nix-hash --type sha256 --flat --sri "$version/$package.$version".nupkg)"
|
||||
found=true
|
||||
break
|
||||
else
|
||||
if sha256=$(nix-prefetch-url "$url" 2>"$tmp"/error); then
|
||||
if hash=$(nix-prefetch-url "$url" 2>"$tmp"/error); then
|
||||
# If multiple remote sources are enabled, nuget will try them all
|
||||
# concurrently and use the one that responds first. We always use the
|
||||
# first source that has the package.
|
||||
@@ -91,9 +91,9 @@ for package in *; do
|
||||
fi
|
||||
|
||||
if [[ "$source" != https://api.nuget.org/v3/index.json ]]; then
|
||||
echo " (fetchNuGet { pname = \"$id\"; version = \"$version\"; sha256 = \"$sha256\"; url = \"$url\"; })"
|
||||
echo " (fetchNuGet { pname = \"$id\"; version = \"$version\"; hash = \"$hash\"; url = \"$url\"; })"
|
||||
else
|
||||
echo " (fetchNuGet { pname = \"$id\"; version = \"$version\"; sha256 = \"$sha256\"; })"
|
||||
echo " (fetchNuGet { pname = \"$id\"; version = \"$version\"; hash = \"$hash\"; })"
|
||||
fi
|
||||
done
|
||||
cd ..
|
||||
|
||||
Reference in New Issue
Block a user