Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 31 lines 1.7 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p common-updater-scripts curl jq 3 4set -euo pipefail 5 6scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd) 7nixpkgs=$(realpath "$scriptDir"/../../../..) 8 9# All architectures are released together, therefore we get the latest version from the linux release 10# NOTE: for some reason, the darwin RELEASES (ie. /darwin/RELEASES) file returns a frozen version... 11echo >&2 "=== Obtaining version data from release.axocdn.com..." 12version=$(curl -fsSL https://api.gitkraken.dev/releases/production/linux/x64/RELEASES | jq -r '.name') 13 14# Hardcoded URLs to compute hashes 15declare -A tarballs=( 16 ["x86_64-linux"]="https://api.gitkraken.dev/releases/production/linux/x64/${version}/gitkraken-amd64.tar.gz" 17 ["x86_64-darwin"]="https://api.gitkraken.dev/releases/production/darwin/x64/${version}/GitKraken-v${version}.zip" 18 ["aarch64-darwin"]="https://api.gitkraken.dev/releases/production/darwin/arm64/${version}/GitKraken-v${version}.zip" 19) 20 21for arch in "${!tarballs[@]}"; do 22 # We precalculate the hash before calling update-source-version because it attempts to calculate each architecture's 23 # package's hash by running `nix-build --system <architecture> -A gitkraken.src` which causes cross compiling headaches 24 echo >&2 "=== Downloading ${arch} package and computing its hash..." 25 hash=$(nix-hash --sri --type sha256 "$(nix-prefetch-url --print-path --unpack "${tarballs[${arch}]}" | tail -n1)") 26 echo >&2 "=== Updating package.nix for ${arch}..." 27 # update-source-version expects to be at the root of nixpkgs 28 (cd "${nixpkgs}" && update-source-version gitkraken "${version}" "${hash}" --system="${arch}" --ignore-same-version) 29done 30 31echo >&2 "=== Done!"