nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python3Packages,
4 fetchFromGitHub,
5
6 # dependencies
7 cmake-format,
8
9 # tests
10 cmake,
11 versionCheckHook,
12}:
13
14let
15 pythonPackages = python3Packages.overrideScope (
16 self: super: {
17 lsprotocol = self.lsprotocol_2023;
18 pygls = self.pygls_1;
19 }
20 );
21in
22pythonPackages.buildPythonApplication rec {
23 pname = "cmake-language-server";
24 version = "0.1.11";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "regen100";
29 repo = "cmake-language-server";
30 tag = "v${version}";
31 hash = "sha256-QxknG5NFYky6ZSjiIugLfHT4gXsyTBVbMMeULhQsmdk=";
32 };
33
34 # Test timeouts occasionally cause the build to fail
35 postPatch = ''
36 substituteInPlace tests/test_server.py \
37 --replace-fail \
38 "CALL_TIMEOUT = 2" \
39 "CALL_TIMEOUT = 10"
40 '';
41
42 build-system = with pythonPackages; [
43 pdm-backend
44 ];
45 dontUseCmakeConfigure = true;
46
47 dependencies = with pythonPackages; [
48 pygls
49 ];
50
51 pythonImportsCheck = [ "cmake_language_server" ];
52
53 nativeCheckInputs = [
54 cmake
55 cmake-format
56 versionCheckHook
57 ]
58 ++ (with pythonPackages; [
59 pytest-datadir
60 pytestCheckHook
61 ]);
62
63 # version.py generated by pdm, no idea why it's not present in test phase
64 # https://github.com/regen100/cmake-language-server/blob/v0.1.11/pyproject.toml#L35-L36
65 preCheck = ''
66 echo "__version__ = \"$PDM_BUILD_SCM_VERSION\"" > cmake_language_server/version.py
67 '';
68
69 disabledTests = [
70 # AssertionError: CTEST_SCP_COMMAND not found
71 "test_parse_variables"
72
73 # AssertionError: AddFileDependencies not found
74 "test_parse_modules"
75
76 # AssertionError: assert 'Boost' in [...
77 "test_completions_triggercharacter"
78 ];
79
80 meta = {
81 description = "CMake LSP Implementation";
82 homepage = "https://github.com/regen100/cmake-language-server";
83 changelog = "https://github.com/regen100/cmake-language-server/releases/tag/${src.tag}";
84 license = lib.licenses.mit;
85 maintainers = with lib.maintainers; [ kira-bruneau ];
86 mainProgram = "cmake-language-server";
87 };
88}