1
0
Fork 0
nix-overlay/packages/tabnine/default.nix
Daniel Kempkens 3365694f92
All checks were successful
Build / build-amd64-linux (push) Successful in 28s
Build / build-arm64-linux (push) Successful in 47s
aerospace: init
2024-06-07 14:26:20 +02:00

55 lines
1.5 KiB
Nix

{ pkgs, lib, ... }:
# Based on: https://github.com/NixOS/nixpkgs/blob/91a00709aebb3602f172a0bf47ba1ef013e34835/pkgs/development/tools/tabnine/default.nix
let
stdenv = pkgs.stdenvNoCC;
sources = lib.importJSON ./sources.json;
platform =
if (builtins.hasAttr stdenv.hostPlatform.system sources.platforms) then
builtins.getAttr (stdenv.hostPlatform.system) sources.platforms
else
throw "Not supported on ${stdenv.hostPlatform.system}";
in
stdenv.mkDerivation {
pname = "tabnine";
inherit (sources) version;
src = pkgs.fetchurl {
url = "https://update.tabnine.com/bundles/${sources.version}/${platform.name}/TabNine.zip";
inherit (platform) hash;
};
dontBuild = true;
# Work around the "unpacker appears to have produced no directories"
# case that happens when the archive doesn't have a subdirectory.
sourceRoot = ".";
nativeBuildInputs = [ pkgs.unzip ];
installPhase = ''
runHook preInstall
install -Dm755 TabNine $out/bin/TabNine
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
runHook postInstall
'';
passthru = {
platform = platform.name;
updateScript = ./update.sh;
};
meta = with lib; {
homepage = "https://tabnine.com";
description = "Smart Compose for code that uses deep learning to help you write code faster";
license = licenses.unfree;
platforms = builtins.attrNames sources.platforms;
};
}