summary refs log tree commit diff stats
path: root/user/modules
diff options
context:
space:
mode:
authorAlan Pearce2019-10-08 19:43:28 +0200
committerAlan Pearce2019-10-08 19:45:27 +0200
commite3a41fb740bd254ef63eeaee0c70a5d854fd0490 (patch)
tree178e21c46889c7935a103478e37ab0d00496b26c /user/modules
parent4381adba4f542479b8863879e66cb9772bf833e2 (diff)
downloadnixfiles-e3a41fb740bd254ef63eeaee0c70a5d854fd0490.tar.lz
nixfiles-e3a41fb740bd254ef63eeaee0c70a5d854fd0490.tar.zst
nixfiles-e3a41fb740bd254ef63eeaee0c70a5d854fd0490.zip
Inline TabNine configuration
Diffstat (limited to 'user/modules')
-rw-r--r--user/modules/tabnine.nix55
1 files changed, 52 insertions, 3 deletions
diff --git a/user/modules/tabnine.nix b/user/modules/tabnine.nix
index f07850ed..8018bcca 100644
--- a/user/modules/tabnine.nix
+++ b/user/modules/tabnine.nix
@@ -1,8 +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 = {
-    recursive = true;
-    source = ../tabnine/.config/TabNine;
+  xdg.configFile."TabNine/TabNine.toml" = {
+    source = configFile cfg.config;
   };
 }