summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--user/modules/tabnine.nix17
1 files changed, 13 insertions, 4 deletions
diff --git a/user/modules/tabnine.nix b/user/modules/tabnine.nix
index dd4d7108..7a207fa2 100644
--- a/user/modules/tabnine.nix
+++ b/user/modules/tabnine.nix
@@ -3,8 +3,9 @@
 with lib;
 
 let
+  inherit (pkgs) stdenv;
   cfg = config.programs.tabnine;
-  configFile = config:
+  lspConfigFile = config:
     pkgs.runCommand "TabNine.toml"
       {
          buildInputs = [ pkgs.remarshal ];
@@ -23,20 +24,28 @@ 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
+      '';
+    };
+
     lspConfig = mkOption {
       type = types.attrs;
       default = {};
       description = ''
         LSP Server configuration written to
-        <filename>~/.config/TabNine/TabNine.toml</filename>.
+        <filename>\${configDir}/TabNine.toml</filename>
         </para><para>
       '';
     };
   };
 
   config = mkIf cfg.enable {
-    xdg.configFile."TabNine/TabNine.toml" = {
-      source = configFile cfg.lspConfig;
+    home.file."${cfg.configDir}/TabNine.toml" = {
+      source = lspConfigFile cfg.lspConfig;
     };
   };
 }