diff options
Diffstat (limited to 'pkgs/by-name/wa/warp-terminal')
-rwxr-xr-x | pkgs/by-name/wa/warp-terminal/update.sh | 37 | ||||
-rw-r--r-- | pkgs/by-name/wa/warp-terminal/versions.json | 12 |
2 files changed, 32 insertions, 17 deletions
diff --git a/pkgs/by-name/wa/warp-terminal/update.sh b/pkgs/by-name/wa/warp-terminal/update.sh index d60e0f1f5aa90..2c9c69dc0cec3 100755 --- a/pkgs/by-name/wa/warp-terminal/update.sh +++ b/pkgs/by-name/wa/warp-terminal/update.sh @@ -1,20 +1,22 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p curl jq moreutils nix-prefetch +#!nix-shell -i bash -p cacert curl jq nix moreutils --pure #shellcheck shell=bash set -eu -o pipefail -dirname="$(dirname "$0")" +cd "$(dirname "$0")" +nixpkgs=../../../../. err() { echo "$*" >&2 + exit 1 } json_get() { - jq -r "$1" < "$dirname/versions.json" + jq -r "$1" < "./versions.json" } json_set() { - jq --arg x "$2" "$1 = \$x" < "$dirname/versions.json" | sponge "$dirname/versions.json" + jq --arg x "$2" "$1 = \$x" < "./versions.json" | sponge "./versions.json" } resolve_url() { @@ -31,7 +33,6 @@ resolve_url() { ;; *) err "Unexpected download type: $1" - exit 1 ;; esac url="https://app.warp.dev/download?package=${pkg}" @@ -40,7 +41,7 @@ resolve_url() { url=$(curl -s -o /dev/null -w '%{redirect_url}' "${url}") [[ ${url} != *.${sfx} ]] || break done - ((i < max_redirects)) || { err "too many redirects"; exit 1; } + ((i < max_redirects)) || { err "too many redirects"; } echo "${url}" } @@ -48,13 +49,27 @@ get_version() { echo "$1" | grep -oP -m 1 '(?<=/v)[\d.\w]+(?=/)' } +# nix-prefect-url seems to be uncompressing the archive then taking the hash +# so just get the hash from fetchurl +sri_get() { + local ouput sri + output=$(nix-build --expr \ + "with import $nixpkgs {}; + fetchurl { + url = \"$1\"; + }" 2>&1 || true) + sri=$(echo "$output" | awk '/^\s+got:\s+/{ print $2 }') + [[ -z "$sri" ]] && err "$output" + echo "$sri" +} + + for sys in darwin linux; do url=$(resolve_url ${sys}) version=$(get_version "${url}") - if [[ ${version} != "$(json_get ".${sys}.version")" ]]; - then - sri=$(nix hash to-sri --type sha256 "$(nix-prefetch-url --type sha256 "${url}")") - json_set ".${sys}.version" "${version}" - json_set ".${sys}.hash" "${sri}" + if [[ ${version} != "$(json_get ".${sys}.version")" ]]; then + sri=$(sri_get "${url}") + json_set ".${sys}.version" "${version}" + json_set ".${sys}.hash" "${sri}" fi done diff --git a/pkgs/by-name/wa/warp-terminal/versions.json b/pkgs/by-name/wa/warp-terminal/versions.json index 99fdfa65c73f2..f0d9321a1f2f6 100644 --- a/pkgs/by-name/wa/warp-terminal/versions.json +++ b/pkgs/by-name/wa/warp-terminal/versions.json @@ -1,10 +1,10 @@ { - "darwin" : { - "hash" : "sha256-tFtoD8URMFfJ3HRkyKStuDStFkoRIV97y9kV4pbDPro=", - "version" : "0.2024.02.20.08.01.stable_01" + "darwin": { + "hash": "sha256-t8Qobl20YXY71vZVAIq6uJ+vnEeT3wFTmAy2dfthvIY=", + "version": "0.2024.04.16.08.02.stable_00" }, - "linux" : { - "hash" : "sha256-L8alnqSE4crrDozRfPaAAMkLc+5+8d9XBKd5ddsxmD0=", - "version" : "0.2024.02.20.08.01.stable_01" + "linux": { + "hash": "sha256-V1bG4Sx0cWv1+5mPnktQ3pPQm6Qwj0Ec6qDXmxGqB+8=", + "version": "0.2024.04.16.08.02.stable_00" } } |