ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / me / mesonlsp / package.nix
blobbd8c307910608adb8ac7b063ec5ef9d10975afeb
2   lib,
3   stdenv,
4   llvmPackages_19,
5   fetchFromGitHub,
7   gtest,
8   makeWrapper,
9   meson,
10   ninja,
11   pkg-config,
12   python3,
14   curl,
15   libarchive,
16   libossp_uuid,
17   libpkgconf,
18   libuuid,
19   nlohmann_json,
20   pkgsStatic,
22   mesonlsp,
23   nix-update-script,
24   testers,
27 let
28   stdenv' = if stdenv.hostPlatform.isDarwin then llvmPackages_19.stdenv else stdenv;
30 stdenv'.mkDerivation (finalAttrs: {
31   pname = "mesonlsp";
32   version = "4.3.7";
34   src = fetchFromGitHub {
35     owner = "JCWasmx86";
36     repo = "mesonlsp";
37     rev = "v${finalAttrs.version}";
38     hash = "sha256-QhZv4PTcf1jzSOcp1+bPZWf5COugCIMq1zkhc0PJjUQ=";
39   };
41   patches = [ ./disable-tests-that-require-network-access.patch ];
43   nativeBuildInputs = [
44     gtest
45     makeWrapper
46     meson
47     ninja
48     pkg-config
49     python3
50   ];
52   buildInputs =
53     [
54       curl
55       libarchive
56       libpkgconf
57       nlohmann_json
58     ]
59     ++ lib.optionals stdenv.hostPlatform.isDarwin [
60       libossp_uuid
61       pkgsStatic.fmt
62     ]
63     ++ lib.optionals stdenv.hostPlatform.isLinux [ libuuid ];
65   mesonFlags = [ "-Dbenchmarks=false" ];
67   mesonCheckFlags = [ "--print-errorlogs" ];
69   doCheck = true;
71   postUnpack =
72     let
73       ada = fetchFromGitHub {
74         owner = "ada-url";
75         repo = "ada";
76         rev = "v2.7.4";
77         hash = "sha256-V5LwL03x7/a9Lvg1gPvgGipo7IICU7xyO2D3GqP6Lbw=";
78       };
80       muon = fetchFromGitHub {
81         owner = "JCWasmx86";
82         repo = "muon";
83         rev = "62af239567ec3b086bae7f02d4aed3a545949155";
84         hash = "sha256-k883mKwuP35f0WtwX8ybl9uYbvA3y6Vxtv2EJMpZDEs=";
85       };
87       sha256 = fetchFromGitHub {
88         owner = "amosnier";
89         repo = "sha-2";
90         rev = "49265c656f9b370da660531db8cc6bf0a2e110a6";
91         hash = "sha256-X9M/ZATYXUiE4oGorPBnsdaKnKaObarnMRh6QEfkBls=";
92       };
94       tomlplusplus = fetchFromGitHub {
95         owner = "marzer";
96         repo = "tomlplusplus";
97         rev = "v3.4.0";
98         hash = "sha256-h5tbO0Rv2tZezY58yUbyRVpsfRjY3i+5TPkkxr6La8M=";
99       };
101       tree-sitter = fetchFromGitHub {
102         owner = "tree-sitter";
103         repo = "tree-sitter";
104         rev = "v0.20.8";
105         hash = "sha256-278zU5CLNOwphGBUa4cGwjBqRJ87dhHMzFirZB09gYM=";
106       };
108       tree-sitter-ini = fetchFromGitHub {
109         owner = "JCWasmx86";
110         repo = "tree-sitter-ini";
111         rev = "20aa563306e9406ac55babb4474521060df90a30";
112         hash = "sha256-1hHjtghBIf7lOPpupT1pUCZQCnzUi4Qt/yHSCdjMhCU=";
113       };
115       tree-sitter-meson = fetchFromGitHub {
116         owner = "JCWasmx86";
117         repo = "tree-sitter-meson";
118         rev = "09665faff74548820c10d77dd8738cd76d488572";
119         hash = "sha256-ice2NdK1/U3NylIQDnNCN41rK/G6uqFOX+OeNf3zm18=";
120       };
121     in
122     ''
123       (
124         cd "$sourceRoot/subprojects"
126         cp -R --no-preserve=mode,ownership ${ada} ada
127         cp "packagefiles/ada/meson.build" ada
129         cp -R --no-preserve=mode,ownership ${muon} muon
131         cp -R --no-preserve=mode,ownership ${sha256} sha256
132         cp "packagefiles/sha256/meson.build" sha256
134         cp -R --no-preserve=mode,ownership ${tomlplusplus} tomlplusplus-3.4.0
136         cp -R --no-preserve=mode,ownership ${tree-sitter} tree-sitter-0.20.8
137         cp "packagefiles/tree-sitter-0.20.8/meson.build" tree-sitter-0.20.8
139         cp -R --no-preserve=mode,ownership ${tree-sitter-ini} tree-sitter-ini
140         cp "packagefiles/tree-sitter-ini/meson.build" tree-sitter-ini
142         cp -R --no-preserve=mode,ownership ${tree-sitter-meson} tree-sitter-meson
143         cp "packagefiles/tree-sitter-meson/meson.build" tree-sitter-meson
144       )
145     '';
147   postPatch = ''
148     substituteInPlace subprojects/muon/include/compilers.h \
149       --replace-fail 'compiler_language new' 'compiler_language new_'
151     patchShebangs src/libtypenamespace
152   '';
154   passthru = {
155     updateScript = nix-update-script { };
156     tests.version = testers.testVersion {
157       package = mesonlsp;
158       version = "v${finalAttrs.version}";
159     };
160   };
162   meta = with lib; {
163     description = "An unofficial, unendorsed language server for Meson written in C++";
164     homepage = "https://github.com/JCWasmx86/mesonlsp";
165     changelog = "https://github.com/JCWasmx86/mesonlsp/releases/tag/v${finalAttrs.version}";
166     license = licenses.gpl3Plus;
167     mainProgram = "mesonlsp";
168     maintainers = with maintainers; [ paveloom ];
169     platforms = platforms.unix;
170     # ../src/liblog/log.cpp:41:7: error: call to 'format' is ambiguous
171     broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64;
172   };