Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, fetchurl, unzip }:
2let
3 sources = lib.importJSON ./sources.json;
4 platform =
5 if (builtins.hasAttr stdenv.hostPlatform.system sources.platforms) then
6 builtins.getAttr (stdenv.hostPlatform.system) sources.platforms
7 else
8 throw "Not supported on ${stdenv.hostPlatform.system}";
9in
10stdenv.mkDerivation {
11 pname = "tabnine";
12 inherit (sources) version;
13
14 src = fetchurl {
15 url = "https://update.tabnine.com/bundles/${sources.version}/${platform.name}/TabNine.zip";
16 inherit (platform) hash;
17 };
18
19 dontBuild = true;
20
21 # Work around the "unpacker appears to have produced no directories"
22 # case that happens when the archive doesn't have a subdirectory.
23 setSourceRoot = "sourceRoot=`pwd`";
24
25 nativeBuildInputs = [ unzip ];
26
27 installPhase = ''
28 runHook preInstall
29 install -Dm755 TabNine $out/bin/TabNine
30 install -Dm755 TabNine-deep-cloud $out/bin/TabNine-deep-cloud
31 install -Dm755 TabNine-deep-local $out/bin/TabNine-deep-local
32 install -Dm755 WD-TabNine $out/bin/WD-TabNine
33 runHook postInstall
34 '';
35
36 passthru = {
37 platform = platform.name;
38 updateScript = ./update.sh;
39 };
40
41 meta = with lib; {
42 homepage = "https://tabnine.com";
43 description = "Smart Compose for code that uses deep learning to help you write code faster";
44 license = licenses.unfree;
45 platforms = attrNames sources.platforms;
46 maintainers = with maintainers; [ lovesegfault ];
47 };
48}