elixir-ls: build LS using the same Elixir version that is used to run LS

The Elixir LS package in Nixpkgs by default used the latest Elixir
version available to compile and run Elixir LS. The user can build
a custom Elixir LS package with a different Elixir version:

    my-custom-elixir-ls = pkgs.elixir-ls.override {
      elixir = my-custom-elixir;
    };

But by doing so the user changes only the Elixir version used to
run Elixir LS; the Elixir version used to compile Elixir LS doesn't
change. As the result, the custom Elixir LS package uses a different
Elixir version at runtime than the Elixir version it was compiled with.

In order to be able to modify the Elixir version used at build time,
I changed `mixRelease` and `fetchMixDeps` to accept `elixir` and
`hex` as parameters (defaults to the latest Elixir and Hex packages).
main
Sergei Maximov 3 years ago committed by Raphael Megzari
parent 45891c5f1c
commit 2a9336b426
  1. 3
      pkgs/development/beam-modules/elixir-ls/default.nix
  2. 4
      pkgs/development/beam-modules/fetch-mix-deps.nix
  3. 4
      pkgs/development/beam-modules/mix-release.nix

@ -5,6 +5,7 @@
mixRelease rec {
pname = "elixir-ls";
version = "0.8.1";
inherit elixir;
src = fetchFromGitHub {
owner = "elixir-lsp";
@ -16,7 +17,7 @@ mixRelease rec {
mixFodDeps = fetchMixDeps {
pname = "mix-deps-${pname}";
inherit src version;
inherit src version elixir;
sha256 = "sha256-OzjToAg+q/ybCyqzNFk28OBsItjFTbdPi416EPh2qX0=";
};

@ -1,4 +1,4 @@
{ stdenvNoCC, lib, elixir, hex, rebar, rebar3, cacert, git }:
{ stdenvNoCC, lib, elixir, hex, rebar, rebar3, cacert, git }@inputs:
{ pname
, version
@ -8,6 +8,8 @@
, debug ? false
, meta ? { }
, patches ? []
, elixir ? inputs.elixir
, hex ? inputs.hex.override { inherit elixir; }
, ...
}@attrs:

@ -1,4 +1,4 @@
{ stdenv, lib, elixir, erlang, findutils, hex, rebar, rebar3, fetchMixDeps, makeWrapper, git, ripgrep }:
{ stdenv, lib, elixir, erlang, findutils, hex, rebar, rebar3, fetchMixDeps, makeWrapper, git, ripgrep }@inputs:
{ pname
, version
@ -15,6 +15,8 @@
# each dependency needs to have a setup hook to add the lib path to $ERL_LIBS
# this is how mix will find dependencies
, mixNixDeps ? { }
, elixir ? inputs.elixir
, hex ? inputs.hex.override { inherit elixir; }
, ...
}@attrs:
let

Loading…
Cancel
Save