diff --git a/pkgs/development/tools/tabnine/default.nix b/pkgs/development/tools/tabnine/default.nix index 49377bd001c6..25ff528c6b9a 100644 --- a/pkgs/development/tools/tabnine/default.nix +++ b/pkgs/development/tools/tabnine/default.nix @@ -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; diff --git a/pkgs/development/tools/tabnine/fetch-latest.sh b/pkgs/development/tools/tabnine/fetch-latest.sh new file mode 100755 index 000000000000..240a55976640 --- /dev/null +++ b/pkgs/development/tools/tabnine/fetch-latest.sh @@ -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