2021-01-06 23:45:24 +00:00
|
|
|
{ stdenv, lib, fetchurl, unzip }:
|
2020-10-01 13:58:15 +01:00
|
|
|
let
|
2021-10-16 16:19:51 +01:00
|
|
|
supportedPlatforms = {
|
|
|
|
"x86_64-linux" = {
|
2021-08-13 23:12:21 +01:00
|
|
|
name = "x86_64-unknown-linux-musl";
|
2021-11-01 22:34:39 +00:00
|
|
|
sha256 = "sha256-On+Sokm2+BV3JbIwK8oPO6882FOWBlgSaAp3VAyR+RM=";
|
2021-10-16 16:19:51 +01:00
|
|
|
};
|
|
|
|
"x86_64-darwin" = {
|
2021-08-13 23:12:21 +01:00
|
|
|
name = "x86_64-apple-darwin";
|
2021-11-01 22:34:39 +00:00
|
|
|
sha256 = "sha256-4YCm42mVcsEvY4I5MWrnbfgUIU7KUIrEirvjN8ISIr0=";
|
2021-10-16 16:19:51 +01:00
|
|
|
};
|
|
|
|
"aarch64-darwin" = {
|
|
|
|
name = "aarch64-apple-darwin";
|
2021-11-01 22:34:39 +00:00
|
|
|
sha256 = "sha256-HN4o5bGX389eAR7ea5EY1JlId8q4lSPGJ4cZo9c2aP4=";
|
2021-10-16 16:19:51 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
platform =
|
|
|
|
if (builtins.hasAttr stdenv.hostPlatform.system supportedPlatforms) then
|
|
|
|
builtins.getAttr (stdenv.hostPlatform.system) supportedPlatforms
|
|
|
|
else
|
|
|
|
throw "Not supported on ${stdenv.hostPlatform.system}";
|
2021-03-27 19:35:04 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-10-01 13:58:15 +01:00
|
|
|
pname = "tabnine";
|
2021-08-13 23:12:21 +01:00
|
|
|
# You can check the latest version with `curl -sS https://update.tabnine.com/bundles/version`
|
2021-11-01 22:34:39 +00:00
|
|
|
version = "3.7.25";
|
2020-10-01 13:58:15 +01:00
|
|
|
|
2021-08-13 23:12:21 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://update.tabnine.com/bundles/${version}/${platform.name}/TabNine.zip";
|
|
|
|
inherit (platform) sha256;
|
|
|
|
};
|
2020-10-01 13:58:15 +01:00
|
|
|
|
|
|
|
dontBuild = true;
|
2021-01-06 23:45:24 +00:00
|
|
|
|
|
|
|
# Work around the "unpacker appears to have produced no directories"
|
|
|
|
# case that happens when the archive doesn't have a subdirectory.
|
|
|
|
setSourceRoot = "sourceRoot=`pwd`";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip ];
|
2020-10-01 13:58:15 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-07-09 19:39:19 +01:00
|
|
|
runHook preInstall
|
2021-01-06 23:45:24 +00:00
|
|
|
install -Dm755 TabNine $out/bin/TabNine
|
2021-04-23 12:35:47 +01:00
|
|
|
install -Dm755 TabNine-deep-cloud $out/bin/TabNine-deep-cloud
|
|
|
|
install -Dm755 TabNine-deep-local $out/bin/TabNine-deep-local
|
|
|
|
install -Dm755 WD-TabNine $out/bin/WD-TabNine
|
2021-07-09 19:39:19 +01:00
|
|
|
runHook postInstall
|
2020-10-01 13:58:15 +01:00
|
|
|
'';
|
|
|
|
|
2021-08-13 23:12:21 +01:00
|
|
|
passthru.platform = platform.name;
|
|
|
|
|
2020-10-01 18:45:58 +01:00
|
|
|
meta = with lib; {
|
2020-10-01 13:58:15 +01:00
|
|
|
homepage = "https://tabnine.com";
|
|
|
|
description = "Smart Compose for code that uses deep learning to help you write code faster";
|
2020-10-01 18:45:58 +01:00
|
|
|
license = licenses.unfree;
|
2021-10-16 16:19:51 +01:00
|
|
|
platforms = [ "x86_64-darwin" "aarch64-darwin" "x86_64-linux" ];
|
2021-07-09 18:54:46 +01:00
|
|
|
maintainers = with maintainers; [ lovesegfault ];
|
2020-10-01 13:58:15 +01:00
|
|
|
};
|
|
|
|
}
|