From 8d9f5216c8cf2a89488a9fa303e0a71557a6fdc4 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Mon, 9 Dec 2019 16:40:22 +0100
Subject: tabnine: switch config directory by system type
---
user/modules/tabnine.nix | 17 +++++++++++++----
1 file 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
- ~/.config/TabNine/TabNine.toml.
+ \${configDir}/TabNine.toml
'';
};
};
config = mkIf cfg.enable {
- xdg.configFile."TabNine/TabNine.toml" = {
- source = configFile cfg.lspConfig;
+ home.file."${cfg.configDir}/TabNine.toml" = {
+ source = lspConfigFile cfg.lspConfig;
};
};
}
--
cgit 1.4.1