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