swiftpm2nix: fix hash mismatch when git submodules exist

This commit is contained in:
Emily Trau 2023-12-31 13:39:00 +11:00
parent 9aafa9b258
commit b732363eed
2 changed files with 2 additions and 1 deletions

View File

@ -29,6 +29,7 @@ in rec {
url = dep.packageRef.location;
rev = dep.state.checkoutState.revision;
sha256 = hashes.${dep.subpath};
fetchSubmodules = true;
})) workspaceState.object.dependencies
);

View File

@ -23,7 +23,7 @@ hashes=""
jq -r '.object.dependencies[] | "\(.subpath) \(.packageRef.location) \(.state.checkoutState.revision)"' $stateFile \
| while read -r name url rev; do
echo >&2 "-- Fetching $name"
sha256="$(nix-prefetch-git $url $rev | jq -r .sha256)"
sha256="$(nix-prefetch-git --fetch-submodules $url $rev | jq -r .sha256)"
hashes+="
\"$name\" = \"$sha256\";"
echo >&2