diff --git a/pkgs/development/tools/tabnine/default.nix b/pkgs/development/tools/tabnine/default.nix index baff8affcbfe..8219487f5540 100644 --- a/pkgs/development/tools/tabnine/default.nix +++ b/pkgs/development/tools/tabnine/default.nix @@ -1,27 +1,23 @@ { stdenv, lib, fetchurl, unzip }: - let - # You can check the latest version with `curl -sS https://update.tabnine.com/bundles/version` - version = "3.5.37"; - src = - if stdenv.hostPlatform.system == "x86_64-darwin" then - fetchurl - { - url = "https://update.tabnine.com/bundles/${version}/x86_64-apple-darwin/TabNine.zip"; - sha256 = "sha256-Vxmhl4/bhRDeByGgkdSF8yEY5wI23WzT2iH1OFkEpck="; - } - else if stdenv.hostPlatform.system == "x86_64-linux" then - fetchurl - { - url = "https://update.tabnine.com/bundles/${version}/x86_64-unknown-linux-musl/TabNine.zip"; - sha256 = "sha256-pttjlx7WWE3nog9L1APp8HN+a4ShhlBj5irHOaPgqHw="; - } - else throw "Not supported on ${stdenv.hostPlatform.system}"; + platform = + if stdenv.hostPlatform.system == "x86_64-linux" then { + name = "x86_64-unknown-linux-musl"; + sha256 = "sha256-pttjlx7WWE3nog9L1APp8HN+a4ShhlBj5irHOaPgqHw="; + } else if stdenv.hostPlatform.system == "x86_64-darwin" then { + name = "x86_64-apple-darwin"; + sha256 = "sha256-Vxmhl4/bhRDeByGgkdSF8yEY5wI23WzT2iH1OFkEpck="; + } else throw "Not supported on ${stdenv.hostPlatform.system}"; in stdenv.mkDerivation rec { pname = "tabnine"; + # You can check the latest version with `curl -sS https://update.tabnine.com/bundles/version` + version = "3.5.37"; - inherit version src; + src = fetchurl { + url = "https://update.tabnine.com/bundles/${version}/${platform.name}/TabNine.zip"; + inherit (platform) sha256; + }; dontBuild = true; @@ -40,6 +36,8 @@ stdenv.mkDerivation rec { runHook postInstall ''; + passthru.platform = platform.name; + meta = with lib; { homepage = "https://tabnine.com"; description = "Smart Compose for code that uses deep learning to help you write code faster"; diff --git a/pkgs/misc/vim-plugins/overrides.nix b/pkgs/misc/vim-plugins/overrides.nix index b2dd6f0f5f0d..60f5fdce6218 100644 --- a/pkgs/misc/vim-plugins/overrides.nix +++ b/pkgs/misc/vim-plugins/overrides.nix @@ -126,8 +126,8 @@ self: super: { buildInputs = [ tabnine ]; postFixup = '' - mkdir $target/binaries - ln -s ${tabnine}/bin/TabNine $target/binaries/TabNine_$(uname -s) + mkdir -p $target/binaries/${tabnine.version} + ln -s ${tabnine}/bin/ $target/binaries/${tabnine.version}/${tabnine.passthru.platform} ''; });