Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 24.05-beta 81 lines 2.8 kB view raw
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 4 5let 6 pname = "elixir-ls"; 7 version = "0.21.1"; 8 src = fetchFromGitHub { 9 owner = "elixir-lsp"; 10 repo = "elixir-ls"; 11 rev = "v${version}"; 12 hash = "sha256-OBLSj1nqv/p1FYg7DapCnr4EU2EW51MQM+YnZqDkcB4="; 13 fetchSubmodules = true; 14 }; 15in 16mixRelease { 17 inherit pname version src elixir; 18 19 stripDebug = true; 20 21 mixFodDeps = fetchMixDeps { 22 pname = "mix-deps-${pname}"; 23 inherit src version elixir; 24 hash = "sha256-3PVMembw3CpYUQ/ynoPKmu0N5iZwoFu9uNjRS+kS4BY="; 25 }; 26 27 # elixir-ls is an umbrella app 28 # override configurePhase to not skip umbrella children 29 configurePhase = '' 30 runHook preConfigure 31 mix deps.compile --no-deps-check 32 runHook postConfigure 33 ''; 34 35 # elixir-ls require a special step for release 36 # compile and release need to be performed together because 37 # of the no-deps-check requirement 38 buildPhase = '' 39 runHook preBuild 40 mix do compile --no-deps-check, elixir_ls.release${lib.optionalString (lib.versionAtLeast elixir.version "1.16.0") "2"} 41 runHook postBuild 42 ''; 43 44 installPhase = '' 45 runHook preInstall 46 mkdir -p $out/bin 47 cp -Rv release $out/lib 48 # Prepare the wrapper script 49 substitute release/language_server.sh $out/bin/elixir-ls \ 50 --replace 'exec "''${dir}/launch.sh"' "exec $out/lib/launch.sh" 51 chmod +x $out/bin/elixir-ls 52 53 substitute release/debug_adapter.sh $out/bin/elixir-debug-adapter \ 54 --replace 'exec "''${dir}/launch.sh"' "exec $out/lib/launch.sh" 55 chmod +x $out/bin/elixir-debug-adapter 56 # prepare the launcher 57 substituteInPlace $out/lib/launch.sh \ 58 --replace "ERL_LIBS=\"\$SCRIPTPATH:\$ERL_LIBS\"" \ 59 "ERL_LIBS=$out/lib:\$ERL_LIBS" \ 60 --replace "exec elixir" "exec ${elixir}/bin/elixir" 61 runHook postInstall 62 ''; 63 64 meta = with lib; { 65 homepage = "https://github.com/elixir-lsp/elixir-ls"; 66 description = '' 67 A frontend-independent IDE "smartness" server for Elixir. 68 Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol" 69 ''; 70 longDescription = '' 71 The Elixir Language Server provides a server that runs in the background, providing IDEs, editors, and other tools with information about Elixir Mix projects. 72 It adheres to the Language Server Protocol, a standard for frontend-independent IDE support. 73 Debugger integration is accomplished through the similar VS Code Debug Protocol. 74 ''; 75 license = licenses.asl20; 76 platforms = platforms.unix; 77 mainProgram = "elixir-ls"; 78 maintainers = teams.beam.members; 79 }; 80 passthru.updateScript = nix-update-script { }; 81}