-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
54 lines (44 loc) · 1.36 KB
/
default.nix
File metadata and controls
54 lines (44 loc) · 1.36 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
{ lib
, callPackage
, runCommand
, makeWrapper
, llvmPackages
, system
, cling
, kernelName
, settings
}:
let
common = callPackage ../../common.nix {};
clangd = llvmPackages.clang-tools;
cnls = callPackage ./cnls.nix { inherit system; };
cling-parser = callPackage ./cling-parser.nix { inherit cling; };
cnls-wrapped = runCommand "cpp-notebook-language-server-wrapped" {
nativeBuildInputs = [ makeWrapper ];
} ''
mkdir -p $out/bin
makeWrapper ${cnls}/bin/cpp-notebook-language-server $out/bin/cpp-notebook-language-server \
--prefix PATH : ${cling-parser}/bin
'';
languageServerName = "clangd";
passthru = {
inherit languageServerName;
};
in
common.writeTextDirWithMetaAndPassthru clangd.meta passthru "lib/codedown/language-servers/cpp-${kernelName}-${languageServerName}.yaml" (lib.generators.toYAML {} [{
name = languageServerName;
version = clangd.version;
extensions = ["cpp" "hpp" "cxx" "hxx" "c" "h"];
notebook_suffix = ".cpp";
attrs = ["cpp"];
type = "stream";
primary = true;
args = [
"${cnls-wrapped}/bin/cpp-notebook-language-server"
"--wrapped-server" "${clangd}/bin/clangd"
]
++ lib.optionals settings.debug ["--log-level" "debug"]
++ lib.optionals settings.super-debug ["--debug-client-writes" "--debug-client-reads" "--debug-server-writes" "--debug-server-reads"]
;
language_id = "cpp";
}])