2023-05-14 16:07:47 +00:00
|
|
|
{ lib, elixir, fetchFromGitHub, fetchMixDeps, mixRelease, nix-update-script }:
|
2021-04-19 10:22:29 +00:00
|
|
|
# Based on the work of Hauleth
|
|
|
|
# None of this would have happened without him
|
|
|
|
|
2021-12-08 00:11:35 +00:00
|
|
|
let
|
2021-04-19 10:22:29 +00:00
|
|
|
pname = "elixir-ls";
|
2023-07-02 13:31:27 +00:00
|
|
|
version = "0.15.1";
|
2021-04-19 10:22:29 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "elixir-lsp";
|
|
|
|
repo = "elixir-ls";
|
2021-04-23 03:59:55 +00:00
|
|
|
rev = "v${version}";
|
2023-07-02 13:31:27 +00:00
|
|
|
hash = "sha256-bWR5wKOVE9qPQyFjiaBumsWwG7vv9pFCVvXO4N8a3HA=";
|
2021-04-19 10:22:29 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
2021-12-08 00:11:35 +00:00
|
|
|
in
|
|
|
|
mixRelease {
|
|
|
|
inherit pname version src elixir;
|
2021-04-19 10:22:29 +00:00
|
|
|
|
2023-05-16 08:50:34 +00:00
|
|
|
stripDebug = true;
|
|
|
|
|
2021-05-19 05:00:12 +00:00
|
|
|
mixFodDeps = fetchMixDeps {
|
2021-04-19 10:22:29 +00:00
|
|
|
pname = "mix-deps-${pname}";
|
2021-11-02 12:57:13 +00:00
|
|
|
inherit src version elixir;
|
2023-07-02 13:31:27 +00:00
|
|
|
hash = "sha256-7AE6RUD7DLo5uTxPMiUDm9MIBYcrNatrIuILK9jinNk=";
|
2021-04-19 10:22:29 +00:00
|
|
|
};
|
|
|
|
|
2023-03-20 19:53:08 +00:00
|
|
|
# elixir-ls is an umbrella app
|
2021-04-19 10:22:29 +00:00
|
|
|
# override configurePhase to not skip umbrella children
|
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
mix deps.compile --no-deps-check
|
|
|
|
runHook postConfigure
|
|
|
|
'';
|
|
|
|
|
2023-03-20 19:53:08 +00:00
|
|
|
# elixir-ls require a special step for release
|
2021-04-19 10:22:29 +00:00
|
|
|
# compile and release need to be performed together because
|
|
|
|
# of the no-deps-check requirement
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
2023-03-23 08:22:10 +00:00
|
|
|
mix do compile --no-deps-check, elixir_ls.release
|
2021-04-19 10:22:29 +00:00
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -Rv release $out/lib
|
|
|
|
# Prepare the wrapper script
|
|
|
|
substitute release/language_server.sh $out/bin/elixir-ls \
|
|
|
|
--replace 'exec "''${dir}/launch.sh"' "exec $out/lib/launch.sh"
|
|
|
|
chmod +x $out/bin/elixir-ls
|
|
|
|
# prepare the launcher
|
|
|
|
substituteInPlace $out/lib/launch.sh \
|
|
|
|
--replace "ERL_LIBS=\"\$SCRIPTPATH:\$ERL_LIBS\"" \
|
|
|
|
"ERL_LIBS=$out/lib:\$ERL_LIBS" \
|
|
|
|
--replace "exec elixir" "exec ${elixir}/bin/elixir"
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/elixir-lsp/elixir-ls";
|
|
|
|
description = ''
|
|
|
|
A frontend-independent IDE "smartness" server for Elixir.
|
|
|
|
Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
|
|
|
|
'';
|
|
|
|
longDescription = ''
|
|
|
|
The Elixir Language Server provides a server that runs in the background, providing IDEs, editors, and other tools with information about Elixir Mix projects.
|
|
|
|
It adheres to the Language Server Protocol, a standard for frontend-independent IDE support.
|
|
|
|
Debugger integration is accomplished through the similar VS Code Debug Protocol.
|
|
|
|
'';
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = teams.beam.members;
|
|
|
|
};
|
2023-05-14 16:07:47 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2021-04-19 10:22:29 +00:00
|
|
|
}
|