swiftpm2nix: use nurl instead of nix-prefetch-git

(cherry picked from commit cfc3088edc)
This commit is contained in:
Olivér Falvai 2024-11-23 20:17:30 +01:00 committed by github-actions[bot]
parent e6675b8404
commit d4ae785ecd
2 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, callPackage, makeWrapper, jq, nix-prefetch-git }: { lib, stdenv, callPackage, makeWrapper, jq, nurl }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "swiftpm2nix"; name = "swiftpm2nix";
@ -10,7 +10,7 @@ stdenv.mkDerivation {
installPhase = '' installPhase = ''
install -vD ${./swiftpm2nix.sh} $out/bin/swiftpm2nix install -vD ${./swiftpm2nix.sh} $out/bin/swiftpm2nix
wrapProgram $out/bin/$name \ wrapProgram $out/bin/$name \
--prefix PATH : ${lib.makeBinPath [ jq nix-prefetch-git ]} \ --prefix PATH : ${lib.makeBinPath [ jq nurl ]} \
''; '';
preferLocalBuild = true; preferLocalBuild = true;

View File

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