about summary refs log tree commit diff
path: root/pkgs/development/tools/tabnine
diff options
context:
space:
mode:
authorBernardo Meurer <bernardo@meurer.org>2021-08-13 15:12:21 -0700
committerBernardo Meurer <bernardo@meurer.org>2021-08-13 16:04:36 -0700
commitb5de556b3499a2ab8adbb836028248ddb26703ed (patch)
tree0d60df0fef32b65825a69c3a58384fdbb0b8a487 /pkgs/development/tools/tabnine
parent196138ea6b9803a42c6720f421db023b953926d2 (diff)
tabnine: expose binary platform in passthru
Diffstat (limited to 'pkgs/development/tools/tabnine')
-rw-r--r--pkgs/development/tools/tabnine/default.nix34
1 files changed, 16 insertions, 18 deletions
diff --git a/pkgs/development/tools/tabnine/default.nix b/pkgs/development/tools/tabnine/default.nix
index baff8affcbfec..8219487f5540b 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";