2021-01-06 23:45:24 +00:00
|
|
|
{ stdenv, lib, fetchurl, unzip }:
|
2020-10-01 12:58:15 +00:00
|
|
|
let
|
2023-05-05 19:39:20 +00:00
|
|
|
sources = lib.importJSON ./sources.json;
|
2021-10-16 15:19:51 +00:00
|
|
|
platform =
|
2022-11-17 17:48:16 +00:00
|
|
|
if (builtins.hasAttr stdenv.hostPlatform.system sources.platforms) then
|
|
|
|
builtins.getAttr (stdenv.hostPlatform.system) sources.platforms
|
2021-10-16 15:19:51 +00:00
|
|
|
else
|
|
|
|
throw "Not supported on ${stdenv.hostPlatform.system}";
|
2021-03-27 19:35:04 +00:00
|
|
|
in
|
2022-01-26 05:33:26 +00:00
|
|
|
stdenv.mkDerivation {
|
2020-10-01 12:58:15 +00:00
|
|
|
pname = "tabnine";
|
2022-11-17 17:48:16 +00:00
|
|
|
inherit (sources) version;
|
2020-10-01 12:58:15 +00:00
|
|
|
|
2021-08-13 22:12:21 +00:00
|
|
|
src = fetchurl {
|
2022-11-17 17:48:16 +00:00
|
|
|
url = "https://update.tabnine.com/bundles/${sources.version}/${platform.name}/TabNine.zip";
|
2022-08-03 07:14:02 +00:00
|
|
|
inherit (platform) hash;
|
2021-08-13 22:12:21 +00:00
|
|
|
};
|
2020-10-01 12:58:15 +00: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.
|
2023-08-10 12:11:22 +00:00
|
|
|
sourceRoot = ".";
|
2021-01-06 23:45:24 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip ];
|
2020-10-01 12:58:15 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-07-09 18:39:19 +00:00
|
|
|
runHook preInstall
|
2021-01-06 23:45:24 +00:00
|
|
|
install -Dm755 TabNine $out/bin/TabNine
|
2021-04-23 11:35:47 +00: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 18:39:19 +00:00
|
|
|
runHook postInstall
|
2020-10-01 12:58:15 +00:00
|
|
|
'';
|
|
|
|
|
2022-11-17 17:48:16 +00:00
|
|
|
passthru = {
|
|
|
|
platform = platform.name;
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
};
|
2021-08-13 22:12:21 +00:00
|
|
|
|
2020-10-01 17:45:58 +00:00
|
|
|
meta = with lib; {
|
2020-10-01 12:58:15 +00:00
|
|
|
homepage = "https://tabnine.com";
|
|
|
|
description = "Smart Compose for code that uses deep learning to help you write code faster";
|
2020-10-01 17:45:58 +00:00
|
|
|
license = licenses.unfree;
|
2022-11-17 17:48:16 +00:00
|
|
|
platforms = attrNames sources.platforms;
|
2021-07-09 17:54:46 +00:00
|
|
|
maintainers = with maintainers; [ lovesegfault ];
|
2020-10-01 12:58:15 +00:00
|
|
|
};
|
|
|
|
}
|