asdf-elixir
asdf-elixir copied to clipboard
mix local.hex does not respect MIX_HOME envvar
We have a parallel build process for some of our umbrella applications, and install hex into the build folder for each job. This works well when using esl-erlang and elixir packages from RPMs.
When using asdf sourced erlang and elixir, the following command gives unexpected results:
> MIX_HOME=/home/vagrant/build/my_project/.mix mix local.hex --force
I would expect the result to be the following (the result of RPM-sourced elixir):
* creating /home/vagrant/build/my_project/.mix/archives/hex-0.16.1
However, this is the result when using asdf sourced elixir:
* creating .asdf/installs/elixir/1.4.2/.mix/archives/hex-0.16.1
This issue also causes problems when trying to use hex dependencies which use Rebar or Rebar3 - the .mix
directory inside .asdf
isn't added to the PATH by default, so compilation fails.
I've tried to mitigate against this by adding the following to my .zshenv
:
# Add the .mix directory for the current GLOBAL asdf version to the PATH (for rebar/rebar3)
export PATH="${HOME}/.asdf/installs/elixir/`asdf current elixir | awk '{print $1}'`/.mix:${PATH}"
A better solution would be to respect MIX_HOME
, or to add the .mix
directory to the PATH automatically (or both?).
If you do not version the archives with the elixir version you will get errors when you switch between elixir versions. I would guess that's why asdf ignores MIX_HOME.
@johnhamelink we already have shims for everything in .mix/escripts
(https://github.com/asdf-vm/asdf-elixir/blob/master/bin/list-bin-paths#L3). Will adding just .mix
solve this issue?
Closing due to lack of a response here. If anyone feels we should re-evaluate please comment.