blob: dd4d71089660c88aef8c1701ae54e06b5abdbe7e (
plain)
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
42
|
{ 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)} \
| sed -e 's/^\["\(.*\)"\]/[\1]/' \
> $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;
};
};
}
|