Proposal: allow env option for Mix.deps.compile

67 views
Skip to first unread message

Dimitrios Zorbas

unread,
Jul 26, 2017, 7:38:03 PM7/26/17
to elixir-lang-core
Hello fellow alchemists,

There are Erlang hex packages which depend on env variables either in Makefiles or in rebar.config.script.
A very popular example package is elixometer, which depends on exometer, which requires setting the EXOMETER_PACKAGES variable
to configure its dependencies (see: https://github.com/Feuerlabs/exometer#dependency-management).

For both Mix.Tasks.Deps.Compile.do_rebar/2 and Mix.Tasks.Deps.Compile.do_rebar3/2 the env for
Mix.Shell.cmd/2 cannot be altered from within mix.exs (see: https://github.com/elixir-lang/elixir/blob/master/lib/mix/lib/mix/tasks/deps.compile.ex#L162).

I propose allowing a dependency declaration like the following in mix.exs:

def deps do
 
{:exometer, "~> 1.2.1", env: [{"EXOMETER_PACKAGES", "(basic), +afunix"}]}
end

That env can be passed to do_compile/2, do_make/2, do_rebar/2, do_rebar3/2.
I have intent to prepare a PR for this change.

Please let me know your thought about this,
Dimitris

José Valim

unread,
Jul 27, 2017, 2:46:08 AM7/27/17
to elixir-l...@googlegroups.com
Yes, this is very reasonable. Please send a PR? Also keep in mind we will need to support env variables on all packages, so even if it is an Elixir package, we will likely need to set the env and then clean it up!



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/8ef2ba77-8752-4fb2-9005-9b51ef434258%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages