Closed barracuda156 closed 1 year ago
The mix install
task is only supposed to be used for development and does not support any custom options.
The recommended way to install hex is using the mix local.hex
that ships with Elixir and it will install hex in $HOME/.mix/archives
or $MIX_HOME/archives
.
If you wish to do a local build of Hex you can use mix archive.build
with the -o
flag to specify an output file path. But note mix will load archives from the archive directory location above.
You can also use mix archive.install
to install archives.
You can find the documentation for these tasks here: https://hexdocs.pm/mix/Mix.Tasks.Local.Hex.html
@ericmj Thank you for replying. I want to add hex
to Macports, since it is needed to build an Elixir package. For that, we have to build it from source (either tarball or fetch from git branch) and install into destroot (installing directly will violate Macports prefix). In result, all files should be in /opt/local/*
(Macports build system will move everything from ${destroot}${prefix}
into ${prefix}
).
Which option would be suitable for that?
mix archive.build && MIX_HOME=/opt/local/... mix archive.install hex.ez
would do that. You also need to set MIX_HOME
before running any mix tasks that use Hex.
EDIT: Although I am not sure how that will work for other Macports users that have Elixir installed and expect MIX_HOME
to be unset since other things will also be affected by that environment variable.
EDIT: Although I am not sure how that will work for other Macports users that have Elixir installed and expect
MIX_HOME
to be unset since other things will also be affected by that environment variable.
Elixir itself is there in Macports (so presumably it will be installed via Macports), but Hex is not, presently. Then, making portfile for Hex, I will set it to depend on port:elixir, that will ensure that Macports’ Elixir is used (if another copy of Elixir is installed, it will be in the path that will not be searched, so hopefully no conflict arises).
Actually, if you use MIX_ARCHIVES
instead of MIX_HOME
it should minimize the risk of conflicts since it is specifically for archives and has no other uses.
How to fix destroot for
hex
? It builds but fails to install.