nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, elixir, fetchFromGitHub, fetchMixDeps, mixRelease }:
2# Based on the work of Hauleth
3# None of this would have happened without him
4
5let
6 pname = "elixir-ls";
7 pinData = lib.importJSON ./pin.json;
8 version = pinData.version;
9 src = fetchFromGitHub {
10 owner = "elixir-lsp";
11 repo = "elixir-ls";
12 rev = "v${version}";
13 sha256 = pinData.sha256;
14 fetchSubmodules = true;
15 };
16in
17mixRelease {
18 inherit pname version src elixir;
19
20 mixFodDeps = fetchMixDeps {
21 pname = "mix-deps-${pname}";
22 inherit src version elixir;
23 sha256 = pinData.depsSha256;
24 };
25
26 # elixir_ls is an umbrella app
27 # override configurePhase to not skip umbrella children
28 configurePhase = ''
29 runHook preConfigure
30 mix deps.compile --no-deps-check
31 runHook postConfigure
32 '';
33
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
37 buildPhase = ''
38 runHook preBuild
39 mix do compile --no-deps-check, elixir_ls.release
40 runHook postBuild
41 '';
42
43 installPhase = ''
44 runHook preInstall
45 mkdir -p $out/bin
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
51 # prepare the launcher
52 substituteInPlace $out/lib/launch.sh \
53 --replace "ERL_LIBS=\"\$SCRIPTPATH:\$ERL_LIBS\"" \
54 "ERL_LIBS=$out/lib:\$ERL_LIBS" \
55 --replace "exec elixir" "exec ${elixir}/bin/elixir"
56 runHook postInstall
57 '';
58
59 meta = with lib; {
60 homepage = "https://github.com/elixir-lsp/elixir-ls";
61 description = ''
62 A frontend-independent IDE "smartness" server for Elixir.
63 Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
64 '';
65 longDescription = ''
66 The Elixir Language Server provides a server that runs in the background, providing IDEs, editors, and other tools with information about Elixir Mix projects.
67 It adheres to the Language Server Protocol, a standard for frontend-independent IDE support.
68 Debugger integration is accomplished through the similar VS Code Debug Protocol.
69 '';
70 license = licenses.asl20;
71 platforms = platforms.unix;
72 maintainers = teams.beam.members;
73 };
74 passthru.updateScript = ./update.sh;
75}