[Question] mix depencency behavior

43 views
Skip to first unread message

Megzari Raphael

unread,
May 11, 2021, 11:45:38 PM5/11/21
to elixir-lang-core

Hi!

    There is an effort at the moment in NixOS to add mix dependency in the store. The idea being that a dependency with a particular version and name can be found and nix understands that a mix project has that particular dependency.

    Currently parsing the mix.lock can give the dependency tree.

    When building a particular dependency which has itself dependencies. How can mix be made aware of where those dependencies are?
    To clarify a little. `plug` has a dependency on `mime` `plug_crypto` and `telemetry`. Once those three dependencies have been compiled, when it's time to compile plug, how can I make mix understand where those dependencies are?
    Should the path of those dependencies be added to the `$ERL_LIBS` env var ?
    Should those compiled dependencies be placed symlinked under `_build/$MIX_ENV/lib` ?

    My understanding is that the compilation will have to happen with `mix compile --no-deps-check`.

   I couldn't find relevant documentation in mix, I would be interested in any pointers.

Christopher Keele

unread,
May 12, 2021, 12:40:29 PM5/12/21
to elixir-lang-core
If you're executing Elixir code within the context of the mix project, you can invoke Mix.Project.deps_paths/{0,1} to figure this out.

Megzari Raphael

unread,
May 12, 2021, 11:19:42 PM5/12/21
to elixir-lang-core
Thank you for your help.

After checking the mix code it seems that the ERL_LIBS is referenced. We are going to go with just adding dependencies paths to the ERL_LIBS for now. After testing it seems that the behavior works. Since the behavior is undocumented we won't be expecting it to be stable.

Thank you for the amazing software!
Reply all
Reply to author
Forward
0 new messages