Skip to content

Commit

Permalink
erlang-ls: fix OTP 27 compatibility (#372731)
Browse files Browse the repository at this point in the history
  • Loading branch information
happysalada authored Jan 10, 2025
2 parents 1abe9f7 + 99876a4 commit e38ef1e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
12 changes: 12 additions & 0 deletions pkgs/development/beam-modules/erlang-ls/1576.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/apps/els_lsp/test/els_completion_SUITE.erl b/apps/els_lsp/test/els_completion_SUITE.erl
index b610b1d4..9c8614f0 100644
--- a/apps/els_lsp/test/els_completion_SUITE.erl
+++ b/apps/els_lsp/test/els_completion_SUITE.erl
@@ -711,6 +711,7 @@ exported_types(Config) ->
<<"filename_all">>,
<<"io_device">>
] ++
+ [<<"io_server">> || OtpRelease >= 27] ++
[<<"location">> || OtpRelease >= 26] ++
[
<<"mode">>,
27 changes: 19 additions & 8 deletions pkgs/development/beam-modules/erlang-ls/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
erlang,
fetchFromGitHub,
fetchgit,
fetchHex,
Expand All @@ -13,6 +14,7 @@ let
version = "1.1.0";
owner = "erlang-ls";
repo = "erlang_ls";

deps = import ./rebar-deps.nix {
inherit fetchHex fetchFromGitHub fetchgit;
builder = buildRebar3;
Expand Down Expand Up @@ -41,12 +43,18 @@ let
in
rebar3Relx {
pname = "erlang-ls";

inherit version;

src = fetchFromGitHub {
inherit owner repo;
hash = "sha256-MSDBU+blsAdeixaHMMXmeMJ+9Yrzn3HekE8KbIc/Guo=";
rev = version;
};

# remove when fixed upstream https://github.com/erlang-ls/erlang_ls/pull/1576
patches = lib.optionals (lib.versionAtLeast erlang.version "27") [ ./1576.diff ];

releaseType = "escript";
beamDeps = builtins.attrValues deps;

Expand All @@ -59,16 +67,11 @@ rebar3Relx {
HOME=. rebar3 ct
HOME=. rebar3 proper --constraint_tries 100
'';
installFlags = [ "PREFIX=$(out)" ];

# tests seem to be a bit flaky on darwin, skip them for now
doCheck = !stdenv.hostPlatform.isDarwin;
installFlags = [ "PREFIX=$(out)" ];
meta = with lib; {
homepage = "https://github.com/erlang-ls/erlang_ls";
description = "Erlang Language Server";
platforms = platforms.unix;
license = licenses.asl20;
mainProgram = "erlang_ls";
};

passthru.updateScript = writeScript "update.sh" ''
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p common-updater-scripts coreutils git gnused gnutar gzip nixfmt-rfc-style "rebar3WithPlugins { globalPlugins = [ beamPackages.rebar3-nix ]; }"
Expand All @@ -88,4 +91,12 @@ rebar3Relx {
echo "erlang-ls is already up-to-date"
fi
'';

meta = with lib; {
homepage = "https://github.com/erlang-ls/erlang_ls";
description = "Erlang Language Server";
platforms = platforms.unix;
license = licenses.asl20;
mainProgram = "erlang_ls";
};
}
4 changes: 1 addition & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7104,13 +7104,11 @@ with pkgs;
erlang_nox = beam_nox.interpreters.erlang;

inherit (beam.packages.erlang)
ex_doc erlfmt elvis-erlang
erlang-ls ex_doc erlfmt elvis-erlang
rebar rebar3 rebar3WithPlugins
fetchHex
lfe lfe_2_1;

inherit (beam.packages.erlang_26) erlang-ls;

beamPackages = dontRecurseIntoAttrs beam27Packages;
beamMinimalPackages = dontRecurseIntoAttrs beamMinimal27Packages;

Expand Down

0 comments on commit e38ef1e

Please sign in to comment.