From 1065e1ba0fce3f7295ad6017b063f6324490aacd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 Jul 2024 16:09:29 +0200 Subject: remove tabnine and all related configuration --- user/modules/tabnine.nix | 94 ------------------------------------------------ 1 file changed, 94 deletions(-) delete mode 100644 user/modules/tabnine.nix (limited to 'user/modules/tabnine.nix') diff --git a/user/modules/tabnine.nix b/user/modules/tabnine.nix deleted file mode 100644 index 3eee4834..00000000 --- a/user/modules/tabnine.nix +++ /dev/null @@ -1,94 +0,0 @@ -{ config -, lib -, pkgs -, ... -}: -with lib; let - inherit (pkgs) stdenv; - tomlFormat = pkgs.formats.toml { }; - cfg = config.programs.tabnine; - lspConfigFile = config: - pkgs.runCommand "TabNine.toml" - { - buildInputs = [ pkgs.remarshal ]; - preferLocalBuild = true; - allowSubstitutes = false; - } - '' - remarshal -if json -of toml \ - < ${pkgs.writeText "config.json" (builtins.toJSON cfg.lspConfig)} \ - | sed -e 's/^\["\(.*\)"\]/[\1]/' \ - > $out - ''; -in -{ - options.programs.tabnine = { - enable = mkEnableOption "TabNine, Smart Compose for code."; - - configDir = mkOption { - type = types.str; - default = - if stdenv.isDarwin - then "Library/Preferences/TabNine" - else "${config.xdg.configHome}/TabNine"; - description = '' - Location of TabNine configuration directory relative to \$HOME - ''; - }; - - config = mkOption { - type = types.attrs; - default = { }; - description = '' - TabNine configuration written to - \${configDir}/tabnine_config.json - ''; - }; - - registrationKey = mkOption { - type = types.str; - description = '' - Registration key for TabNine. For one-time-purchase users, this should be the e-mail address and base-64-encoded key joined together without spacing. - ''; - }; - - lspConfig = mkOption { - type = tomlFormat.type; - default = { }; - description = '' - LSP Server configuration written to - \${configDir}/TabNine.toml - - ''; - }; - }; - - config = mkIf cfg.enable { - home.file."${cfg.configDir}/TabNine.toml" = { - source = (tomlFormat.generate "TabNine.toml" cfg.lspConfig); - }; - home.file."${cfg.configDir}/tabnine_config.json" = { - source = pkgs.writeText "tabnine_config.json" (builtins.toJSON cfg.config); - }; - home.file."${cfg.configDir}/registration_key" = { - text = cfg.registrationKey; - }; - - programs.neovim.plugins = [ - pkgs.vimPlugins.coc-tabnine - ]; - programs.neovim.coc.settings = { - "tabnine.binary_path" = "${pkgs.tabnine}/bin/TabNine"; - }; - - programs.emacs.extraPackages = epkgs: [ - epkgs.tabnine - ]; - programs.emacs.extraConfig = '' - (defun my/override-tabnine-exe-path (&rest args) - "${pkgs.tabnine}/bin/TabNine") - (with-eval-after-load 'tabnine - (advice-add 'tabnine--executable-path :override #'my/override-tabnine-exe-path)) - ''; - }; -} -- cgit 1.4.1