all repos — nixfiles @ 8d9f5216c8cf2a89488a9fa303e0a71557a6fdc4

System and user configuration, managed by nix and home-manager

tabnine: switch config directory by system type

Alan Pearce
commit

8d9f5216c8cf2a89488a9fa303e0a71557a6fdc4

parent

ca4537a8e0f19baf3b83c0308bf444d71427906a

1 file changed, 13 insertions(+), 4 deletions(-)

jump to
M user/modules/tabnine.nixuser/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 @@
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; }; }; }