-
-
Notifications
You must be signed in to change notification settings - Fork 19.5k
Expand file tree
/
Copy pathdefault.nix
More file actions
109 lines (92 loc) · 3.09 KB
/
Copy pathdefault.nix
File metadata and controls
109 lines (92 loc) · 3.09 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{
lib,
stdenv,
fetchFromGitHub,
ninja,
makeWrapper,
CoreFoundation,
Foundation,
ditto,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "lua-language-server";
version = "3.12.0";
src = fetchFromGitHub {
owner = "luals";
repo = "lua-language-server";
rev = finalAttrs.version;
hash = "sha256-wyQ4oXGemoT5QVZughFKd386RjzlW4ArtQL0ofMnhpU=";
fetchSubmodules = true;
};
nativeBuildInputs = [
ninja
makeWrapper
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
CoreFoundation
Foundation
ditto
];
postPatch =
''
# filewatch tests are failing on darwin
# this feature is not used in lua-language-server
sed -i /filewatch/d 3rd/bee.lua/test/test.lua
# flaky tests on linux
# https://github.com/LuaLS/lua-language-server/issues/2926
sed -i /load-relative-library/d test/tclient/init.lua
pushd 3rd/luamake
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
# This package uses the program clang for C and C++ files. The language
# is selected via the command line argument -std, but this do not work
# in combination with the nixpkgs clang wrapper. Therefor we have to
# find all c++ compiler statements and replace $cc (which expands to
# clang) with clang++.
sed -i compile/ninja/macos.ninja \
-e '/c++/s,$cc,clang++,' \
-e '/test.lua/s,= .*,= true,' \
-e '/ldl/s,$cc,clang++,'
sed -i scripts/compiler/gcc.lua \
-e '/cxx_/s,$cc,clang++,'
'';
ninjaFlags = [
"-fcompile/ninja/${if stdenv.hostPlatform.isDarwin then "macos" else "linux"}.ninja"
];
postBuild = ''
popd
./3rd/luamake/luamake rebuild
'';
installPhase = ''
runHook preInstall
install -Dt "$out"/share/lua-language-server/bin bin/lua-language-server
install -m644 -t "$out"/share/lua-language-server/bin bin/*.*
install -m644 -t "$out"/share/lua-language-server {debugger,main}.lua
cp -r locale meta script "$out"/share/lua-language-server
# necessary for --version to work:
install -m644 -t "$out"/share/lua-language-server changelog.md
makeWrapper "$out"/share/lua-language-server/bin/lua-language-server \
$out/bin/lua-language-server \
--add-flags "-E $out/share/lua-language-server/main.lua \
--logpath=\''${XDG_CACHE_HOME:-\$HOME/.cache}/lua-language-server/log \
--metapath=\''${XDG_CACHE_HOME:-\$HOME/.cache}/lua-language-server/meta"
runHook postInstall
'';
# some tests require local networking
__darwinAllowLocalNetworking = true;
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Language server that offers Lua language support";
homepage = "https://github.com/luals/lua-language-server";
changelog = "https://github.com/LuaLS/lua-language-server/blob/${finalAttrs.version}/changelog.md";
license = licenses.mit;
maintainers = with maintainers; [
figsoda
gepbird
sei40kr
];
mainProgram = "lua-language-server";
platforms = platforms.linux ++ platforms.darwin;
};
})