How do you use other libraries without Mix?

I am learning Elixir from ground up and I want to use to libraries I have come across to organize structures, ExConstructor and ExSamples.

I know that Mix is the proper way to add external libraries to your projects, but would still like to know how it could be done. I want to have an idea of the underpinnings of what Mix is doing in the background.


So you want to do everything that mix does on your own? That seems like an awful lot of work for very little gain in the end.

I’d start reading here for the docs and look at the code here. The dep and compilers directories should be interesting, as you’ll have to deal with dependency trees and compiling for your deps.

I have no desire to duplicate Mix, I just want to understand how things work behind the scenes, starting from basics. For instance I have started a small Elixir project - Help with choosing data structures for template project, all that source code is in a file named templates.ex.

If I want to start a mix project around the modules in that, how would I go about it? Mix does a lot of magic in the background but I need some knowledge of how Elixir programs are structured. I understand that Elixir works around the concept of the module, but what is going on when mix compiles them and ties them up together?

If you look at the mix page on hexdocs, you see only the skeleton. It doesn’t show how the actually working modules is integrated to it. In the application function there is a list such as

def application do
  [mod: {MyApp, []}]

There is no real clarity as to how the code in templates.ex I want to use end up integrated in the mod area or how I can even access them in iex.

Have you taken a look at the Getting started guide’s section on Dependencies and Umbrella Projects?

In reference to my project, I have learned that escript builds are what I need from my project as it is designed to run from the command line.

Another problem I am facing is that a lot of the examples I am learning from are based on earlier versions of mix and elixir, and the project structure and file contents are different.