summary refs log tree commit diff
path: root/pkgs/development/tools/tabnine/fetch-latest.sh
blob: 240a55976640b51404df8b36f32201ad0196d1a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash

set -euo pipefail

function prefetch-sri() {
    nix-prefetch-url "$1" 2>/dev/null | xargs nix hash to-sri --type sha256
}

declare -a PLATFORMS=(
    x86_64-unknown-linux-musl
    x86_64-apple-darwin
    aarch64-apple-darwin
)

LATEST="$(curl -sS https://update.tabnine.com/bundles/version)"

cat <<-EOF
version = "${LATEST}";
EOF

for platform in "${PLATFORMS[@]}"; do
    url="https://update.tabnine.com/bundles/${LATEST}/${platform}/TabNine.zip"
    sha="$(prefetch-sri "$url")"
    cat <<-EOF
name = "${platform}";
hash = "${sha}";

EOF
done