tabnine: add crude management of tabnine installation and config
Alan Pearce alan@alanpearce.eu
Mon, 09 Dec 2019 17:27:14 +0100
2 files changed, 71 insertions(+), 13 deletions(-)
M user/modules/tabnine.nix → user/modules/tabnine.nix
@@ -32,6 +32,15 @@ Location of TabNine configuration directory relative to \$HOME ''; }; + config = mkOption { + type = types.attrs; + default = { }; + description = '' + TabNine configuration written to + <filename>\${configDir}/tabnine_config.json</filename> + ''; + }; + lspConfig = mkOption { type = types.attrs; default = {}; @@ -46,6 +55,9 @@ config = mkIf cfg.enable { 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); }; }; }
M user/settings/tabnine.nix → user/settings/tabnine.nix
@@ -1,44 +1,90 @@-{ ... }: +{ pkgs, ... }: + +let + inherit (pkgs) stdenv; -{ - imports = [ - ../modules/tabnine.nix - ]; + 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"; + }); }; }