summary refs log tree commit diff stats
path: root/user/settings/tabnine.nix
diff options
context:
space:
mode:
Diffstat (limited to 'user/settings/tabnine.nix')
-rw-r--r--user/settings/tabnine.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/user/settings/tabnine.nix b/user/settings/tabnine.nix
new file mode 100644
index 00000000..8018bcca
--- /dev/null
+++ b/user/settings/tabnine.nix
@@ -0,0 +1,57 @@
+{ config, pkgs, ... }:
+
+let
+  cfg = {
+    config = {
+      "language.typescript" = {
+        command = "typescript-language-server";
+        args = ["--stdio"];
+      };
+      "language.javascript" = {
+        command = "javascript-typescript-stdio";
+        args = ["--stdio"];
+      };
+      "language.css" = {
+        command = "css-languageserver";
+        args = ["--stdio"];
+      };
+      "language.scss" = {
+        command = "css-languageserver";
+        args = ["--stdio"];
+      };
+      "language.html" = {
+        command = "html-languageserver";
+        args = ["--stdio"];
+      };
+      "language.dockerfile" = {
+        command = "docker-langserver";
+        args = ["--stdio"];
+      };
+      "language.yaml" = {
+        command = "yaml-language-server";
+        args = ["--stdio"];
+      };
+      "language.haskell" = {
+        command = "hie";
+        args = ["--stdio"];
+      };
+    };
+  };
+  configFile = config:
+    pkgs.runCommand "TabNine.toml"
+      {
+         buildInputs = [ pkgs.remarshal ];
+         preferLocalBuild = true;
+         allowSubstitutes = false;
+      }
+      ''
+        remarshal -if json -of toml \
+          < ${pkgs.writeText "config.json" (builtins.toJSON cfg.config)} \
+          > $out
+      '';
+in
+{
+  xdg.configFile."TabNine/TabNine.toml" = {
+    source = configFile cfg.config;
+  };
+}