Merge pull request #184957 from lovesegfault/tabnine-update

This commit is contained in:
Sandro 2022-08-03 14:53:23 +02:00 committed by GitHub
commit ac61a6427a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 5 deletions

View file

@ -1,19 +1,20 @@
{ stdenv, lib, fetchurl, unzip }:
let
# You can check the latest version with `curl -sS https://update.tabnine.com/bundles/version`
version = "4.4.40";
# There's a handy prefetch script in ./fetch-latest.sh
version = "4.4.98";
supportedPlatforms = {
"x86_64-linux" = {
name = "x86_64-unknown-linux-musl";
sha256 = "sha256-goPPGU4oZWBD/C15rbbX5YMqua16A4MdLhBoC4JxaCI=";
hash = "sha256-AYgv/XrHjEOhtyx8QeOhssdsc/fssShZcA+15fFgI1g=";
};
"x86_64-darwin" = {
name = "x86_64-apple-darwin";
sha256 = "sha256-CgYHQ91U6K3+kMyOSSia2B7IncR5u0eq9h3EZiBsRdU=";
hash = "sha256-XUd97ZUUb8XqMrlnSBER68fU3+58zpwKnzZ+i3dlWIs=";
};
"aarch64-darwin" = {
name = "aarch64-apple-darwin";
sha256 = "sha256-JwX3TdKYmLQO3mWb15Ds/60VAAurGxqfJlMCQqy2pxg=";
hash = "sha256-L2r4fB4OtJJUvwnFP7zYAm8RLf8b7r6kDNGlwZRkLnw=";
};
};
platform =
@ -28,7 +29,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "https://update.tabnine.com/bundles/${version}/${platform.name}/TabNine.zip";
inherit (platform) sha256;
inherit (platform) hash;
};
dontBuild = true;

View file

@ -0,0 +1,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