1{
2 lib,
3 elixir,
4 fetchpatch,
5 fetchFromGitHub,
6 makeWrapper,
7 stdenv,
8 nix-update-script,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "elixir-ls";
13 version = "0.28.1";
14
15 src = fetchFromGitHub {
16 owner = "elixir-lsp";
17 repo = "elixir-ls";
18 rev = "v${version}";
19 hash = "sha256-r4P+3MPniDNdF3SG2jfBbzHsoxn826eYd2tsv6bJBoI=";
20 };
21
22 patches = [
23 # fix elixir deterministic support https://github.com/elixir-lsp/elixir-ls/pull/1216
24 # remove > 0.28.1
25 (fetchpatch {
26 url = "https://github.com/elixir-lsp/elixir-ls/pull/1216.patch";
27 hash = "sha256-J1Q7XQXWYuCMq48e09deQU71DOElZ2zMTzrceZMky+0=";
28 })
29
30 # patch wrapper script to remove elixir detection and inject necessary paths
31 ./launch.sh.patch
32 ];
33
34 nativeBuildInputs = [
35 makeWrapper
36 ];
37
38 # for substitution
39 env.elixir = elixir;
40
41 dontConfigure = true;
42 dontBuild = true;
43
44 installPhase = ''
45 cp -R . $out
46 ln -s $out/VERSION $out/scripts/VERSION
47
48 substituteAllInPlace $out/scripts/launch.sh
49
50 mkdir -p $out/bin
51
52 makeWrapper $out/scripts/language_server.sh $out/bin/elixir-ls \
53 --set ELS_LOCAL "1"
54
55 makeWrapper $out/scripts/debug_adapter.sh $out/bin/elixir-debug-adapter \
56 --set ELS_LOCAL "1"
57
58 runHook postInstall
59 '';
60
61 meta = with lib; {
62 homepage = "https://github.com/elixir-lsp/elixir-ls";
63 description = ''
64 A frontend-independent IDE "smartness" server for Elixir.
65 Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
66 '';
67 longDescription = ''
68 The Elixir Language Server provides a server that runs in the background, providing IDEs, editors, and other tools with information about Elixir Mix projects.
69 It adheres to the Language Server Protocol, a standard for frontend-independent IDE support.
70 Debugger integration is accomplished through the similar VS Code Debug Protocol.
71 '';
72 license = licenses.asl20;
73 platforms = platforms.unix;
74 mainProgram = "elixir-ls";
75 teams = [ teams.beam ];
76 };
77 passthru.updateScript = nix-update-script { };
78}