user/modules/tabnine.nix (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | { config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.tabnine;
configFile = 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)} \
> $out
'';
in
{
options.programs.tabnine = {
enable = mkEnableOption "TabNine, Smart Compose for code.";
lspConfig = mkOption {
type = types.attrs;
default = {};
description = ''
LSP Server configuration written to
<filename>~/.config/TabNine/TabNine.toml</filename>.
</para><para>
'';
};
};
config = mkIf cfg.enable {
xdg.configFile."TabNine/TabNine.toml" = {
source = configFile cfg.lspConfig;
};
};
}
|