forgejo: use "predictable URLs" as src

Not sure how long codeberg.org already supports this.
I only just found out about them after a maintainer mentioned them in https://matrix.to/#/#forgejo-chat:matrix.org
Similar URLs are also used at https://forgejo.org/download/
This commit is contained in:
IndeedNotJames 2023-04-05 23:04:35 +02:00
parent 9c8ff8b426
commit 0dd0b2103a
No known key found for this signature in database
GPG Key ID: 0AD773CE46FD0F87

View File

@ -28,9 +28,7 @@ buildGoModule rec {
version = "1.19.0-2";
src = fetchurl {
name = "${pname}-src-${version}.tar.gz";
# see https://codeberg.org/forgejo/forgejo/releases
url = "https://codeberg.org/attachments/2bf497db-fa91-4260-9c98-5c791b6b397c";
url = "https://codeberg.org/forgejo/forgejo/releases/download/v${version}/forgejo-src-${version}.tar.gz";
hash = "sha256-neDIT+V3qHR8xgP4iy4TJQ6PCWO3svpSA7FLCacQSMI=";
};
@ -105,7 +103,6 @@ buildGoModule rec {
| { $version, html_url } + (.assets | map(select(.name | startswith($filename)) | {(.name | split(".") | last): .browser_download_url}) | add)' \
<<< "$releases")
archive_url=$(jq -r .gz <<< "$stable")
checksum_url=$(jq -r .sha256 <<< "$stable")
release_url=$(jq -r .html_url <<< "$stable")
version=$(jq -r .version <<< "$stable")
@ -120,7 +117,7 @@ buildGoModule rec {
sha256=$(curl "$checksum_url" --silent | cut --delimiter " " --fields 1)
sri_hash=$(nix hash to-sri --type sha256 "$sha256")
update-source-version "${pname}" "$version" "$sri_hash" "$archive_url"
update-source-version "${pname}" "$version" "$sri_hash"
'';
});
};