1 { lib, elixir, fetchFromGitHub, fetchMixDeps, mixRelease, nix-update-script }:
2 # Based on the work of Hauleth
3 # None of this would have happened without him
8 src = fetchFromGitHub {
12 hash = "sha256-d5O7DGEKuwHbjxwJa3HNtaycQIzFTi74UxszRH7TVzQ=";
16 inherit pname version src elixir;
20 mixFodDeps = fetchMixDeps {
21 pname = "mix-deps-${pname}";
22 inherit src version elixir;
23 hash = "sha256-OxQeIdqjY/k02q+nLQnZ+/Zxy/bdjjSCRrVu0usQcsc=";
26 # elixir-ls is an umbrella app
27 # override configurePhase to not skip umbrella children
30 mix deps.compile --no-deps-check
34 # elixir-ls require a special step for release
35 # compile and release need to be performed together because
36 # of the no-deps-check requirement
39 mix do compile --no-deps-check, elixir_ls.release${lib.optionalString (lib.versionAtLeast elixir.version "1.16.0") "2"}
46 cp -Rv release $out/lib
47 # Prepare the wrapper script
48 substitute release/language_server.sh $out/bin/elixir-ls \
49 --replace 'exec "''${dir}/launch.sh"' "exec $out/lib/launch.sh"
50 chmod +x $out/bin/elixir-ls
52 substitute release/debug_adapter.sh $out/bin/elixir-debug-adapter \
53 --replace 'exec "''${dir}/launch.sh"' "exec $out/lib/launch.sh"
54 chmod +x $out/bin/elixir-debug-adapter
55 # prepare the launchers
56 substituteInPlace $out/lib/launch.sh \
57 --replace "ERL_LIBS=\"\$SCRIPTPATH:\$ERL_LIBS\"" \
58 "ERL_LIBS=$out/lib:\$ERL_LIBS" \
59 --replace "exec elixir" "exec ${elixir}/bin/elixir" \
60 --replace 'echo "" | elixir' "echo \"\" | ${elixir}/bin/elixir"
61 substituteInPlace $out/lib/exec.zsh \
62 --replace "exec elixir" "exec ${elixir}/bin/elixir"
67 homepage = "https://github.com/elixir-lsp/elixir-ls";
69 A frontend-independent IDE "smartness" server for Elixir.
70 Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
73 The Elixir Language Server provides a server that runs in the background, providing IDEs, editors, and other tools with information about Elixir Mix projects.
74 It adheres to the Language Server Protocol, a standard for frontend-independent IDE support.
75 Debugger integration is accomplished through the similar VS Code Debug Protocol.
77 license = licenses.asl20;
78 platforms = platforms.unix;
79 mainProgram = "elixir-ls";
80 maintainers = teams.beam.members;
82 passthru.updateScript = nix-update-script { };