summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--user/modules/tabnine.nix12
-rw-r--r--user/settings/tabnine.nix72
2 files changed, 71 insertions, 13 deletions
diff --git a/user/modules/tabnine.nix b/user/modules/tabnine.nix
index 7a207fa2..c2b9a746 100644
--- a/user/modules/tabnine.nix
+++ b/user/modules/tabnine.nix
@@ -32,6 +32,15 @@ in
       '';
     };
 
+    config = mkOption {
+      type = types.attrs;
+      default = { };
+      description = ''
+        TabNine configuration written to
+        <filename>\${configDir}/tabnine_config.json</filename>
+      '';
+    };
+
     lspConfig = mkOption {
       type = types.attrs;
       default = {};
@@ -47,5 +56,8 @@ in
     home.file."${cfg.configDir}/TabNine.toml" = {
       source = lspConfigFile cfg.lspConfig;
     };
+    home.file."${cfg.configDir}/tabnine_config.json" = {
+      source = pkgs.writeText "tabnine_config.json" (builtins.toJSON cfg.config);
+    };
   };
 }
diff --git a/user/settings/tabnine.nix b/user/settings/tabnine.nix
index 9fa586b0..6a9e88a0 100644
--- a/user/settings/tabnine.nix
+++ b/user/settings/tabnine.nix
@@ -1,44 +1,90 @@
-{ ... }:
+{ pkgs, ... }:
 
-{
-  imports = [
-    ../modules/tabnine.nix
-  ];
+let
+  inherit (pkgs) stdenv;
+
+  version = "2.1.21";
+  target = if stdenv.isDarwin then
+    "x86_64-apple-darwin"
+  else
+    "x86_64-unknown-linux-musl";
+in {
+  imports = [ ../modules/tabnine.nix ];
   programs.tabnine = {
     enable = true;
+    config = {
+      inherit version;
+
+      hide_promotional_message = true;
+      beta_enabled = "No";
+      ignore_all_lsp = false;
+      creation_time = "2019-08-26T09:51:35.732522096Z";
+      semantic_status = {
+        typescript = "Enabled";
+        javascript = "Enabled";
+        yaml = "Enabled";
+      };
+      disable_auto_update = true;
+      user_understands_that_enabling_tabnine_cloud_sends_code_to_tabnine_servers =
+        false;
+      hosted_deep_completions_enabled = "Disabled";
+      tabnine_cloud_host = null;
+      tabnine_cloud_port = null;
+      cloud_whitelist = [ ];
+      api_key = null;
+      api_key_service_level = null;
+      api_base_url = null;
+      local_enabled = "No";
+      disable_local_when_using_battery = true;
+      hide_deep_information_message = false;
+      enable_power_saving_mode = false;
+      rate_limit_interval_seconds = null;
+      rate_limit_amount = null;
+    };
     lspConfig = {
       "language.typescript" = {
         command = "typescript-language-server";
-        args = ["--stdio"];
+        args = [ "--stdio" ];
       };
       "language.javascript" = {
         command = "javascript-typescript-stdio";
-        args = ["--stdio"];
+        args = [ "--stdio" ];
       };
       "language.css" = {
         command = "css-languageserver";
-        args = ["--stdio"];
+        args = [ "--stdio" ];
       };
       "language.scss" = {
         command = "css-languageserver";
-        args = ["--stdio"];
+        args = [ "--stdio" ];
       };
       "language.html" = {
         command = "html-languageserver";
-        args = ["--stdio"];
+        args = [ "--stdio" ];
       };
       "language.dockerfile" = {
         command = "docker-langserver";
-        args = ["--stdio"];
+        args = [ "--stdio" ];
       };
       "language.yaml" = {
         command = "yaml-language-server";
-        args = ["--stdio"];
+        args = [ "--stdio" ];
       };
       "language.haskell" = {
         command = "hie";
-        args = ["--stdio"];
+        args = [ "--stdio" ];
       };
     };
   };
+
+  home.file.".local/tabnine/${version}/${target}/TabNine" = {
+    executable = true;
+    source = (pkgs.fetchurl {
+      url = "https://update.tabnine.com/${version}/${target}/TabNine";
+      sha256 = if stdenv.isDarwin then
+        "00kjin3d9fq7332b8nm4ylli007fqbph42h7mykmk4lssy9dy8mm"
+      else
+        "0926qag5p513hxljc7qwmyi32y2grlhfdiz899i0rxky8rkcwhqh";
+    });
+  };
 }