elixir-ls: force local installation

This commit is contained in:
Adam C. Stephens
2025-07-23 13:00:55 -04:00
parent 29da035f95
commit b051a144dc
3 changed files with 20 additions and 34 deletions

View File

@@ -89,7 +89,7 @@ let
inherit fetchMixDeps mixRelease;
};
elixir-ls = callPackage ./elixir-ls { inherit elixir fetchMixDeps mixRelease; };
elixir-ls = callPackage ./elixir-ls { inherit elixir; };
lfe = lfe_2_1;
lfe_2_1 = lib'.callLFE ../interpreters/lfe/2.1.nix { inherit erlang buildRebar3 buildHex; };

View File

@@ -3,13 +3,12 @@
elixir,
fetchpatch,
fetchFromGitHub,
fetchMixDeps,
makeWrapper,
mixRelease,
stdenv,
nix-update-script,
}:
mixRelease rec {
stdenv.mkDerivation rec {
pname = "elixir-ls";
version = "0.28.1";
@@ -20,16 +19,6 @@ mixRelease rec {
hash = "sha256-r4P+3MPniDNdF3SG2jfBbzHsoxn826eYd2tsv6bJBoI=";
};
inherit elixir;
stripDebug = true;
mixFodDeps = fetchMixDeps {
pname = "mix-deps-${pname}";
inherit src version elixir;
hash = "sha256-8zs+99jwf+YX5SwD65FCPmfrYhTCx4AQGCGsDeCKxKc=";
};
patches = [
# fix elixir deterministic support https://github.com/elixir-lsp/elixir-ls/pull/1216
# remove > 0.28.1
@@ -46,28 +35,25 @@ mixRelease rec {
makeWrapper
];
# elixir-ls require a special step for release
# compile and release need to be performed together because
# of the no-deps-check requirement
buildPhase = ''
runHook preBuild
# for substitution
env.elixir = elixir;
mix do compile --no-deps-check, elixir_ls.release${lib.optionalString (lib.versionAtLeast elixir.version "1.16.0") "2"}
runHook postBuild
'';
dontConfigure = true;
dontBuild = true;
installPhase = ''
cp -R . $out
ln -s $out/VERSION $out/scripts/VERSION
substituteAllInPlace $out/scripts/launch.sh
mkdir -p $out/bin
cp -Rv release $out/libexec
substituteAllInPlace $out/libexec/launch.sh
makeWrapper $out/scripts/language_server.sh $out/bin/elixir-ls \
--set ELS_LOCAL "1"
makeWrapper $out/libexec/language_server.sh $out/bin/elixir-ls \
--set ELS_INSTALL_PREFIX "$out/libexec"
makeWrapper $out/libexec/debug_adapter.sh $out/bin/elixir-debug-adapter \
--set ELS_INSTALL_PREFIX "$out/libexec"
makeWrapper $out/scripts/debug_adapter.sh $out/bin/elixir-debug-adapter \
--set ELS_LOCAL "1"
runHook postInstall
'';

View File

@@ -1,6 +1,6 @@
diff --git i/scripts/launch.sh w/scripts/launch.sh
index 21afbb1e..975cbdf0 100755
--- i/scripts/launch.sh
diff --git c/scripts/launch.sh w/scripts/launch.sh
index 21afbb1e..6b61f0b4 100755
--- c/scripts/launch.sh
+++ w/scripts/launch.sh
@@ -1,125 +1,4 @@
-#!/bin/sh
@@ -140,7 +140,7 @@ index 21afbb1e..975cbdf0 100755
- SCRIPTPATH=${ELS_INSTALL_PREFIX}
-fi
+SCRIPT=$(readlink -f "$0")
+SCRIPTPATH=$(dirname "$SCRIPT")/../libexec
+SCRIPTPATH=$(dirname "$SCRIPT")/../scripts
export MIX_ENV=prod
# Mix.install prints to stdout and reads from stdin