Unverified Commit 0dd0b210 authored by IndeedNotJames's avatar IndeedNotJames
Browse files

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/
parent 9c8ff8b4
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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"
      '';
    });
  };