asdf-elixir icon indicating copy to clipboard operation
asdf-elixir copied to clipboard

mix local.hex does not respect MIX_HOME envvar

Open ngeraedts opened this issue 7 years ago • 3 comments

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

ngeraedts avatar Aug 03 '17 21:08 ngeraedts

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?).

johnhamelink avatar Jan 08 '18 14:01 johnhamelink

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.

ericmj avatar Jan 08 '18 14:01 ericmj

@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?

Stratus3D avatar Oct 17 '18 14:10 Stratus3D

Closing due to lack of a response here. If anyone feels we should re-evaluate please comment.

Stratus3D avatar Nov 17 '22 20:11 Stratus3D