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