Mix archives: can I have several of Phoenix's (different versions) and use them concurrently?

Hey everyone,
I am interested in making a tree diff of freshly generated Phoenix projects and projects that have been in development for a while. I’d just like to have it at quick glance what’s the difference from the bare-bones app that would be generated with the Phoenix generator versus the actual app.

To that end, I was unable to find a way to use several different versions of the same Mix archive and be able to specify which version of the archive to use.

In general, Mix archives seems rather awkward to manage and something that regularly catches me with my pants down. I keep forgetting to check for Phoenix’s Mix archive version, but others have bitten me in the past as well. Is there anything we as a community can do to help there, by the way?

And, is there a way to do what I am after? Except for installing a particular version, using it, then deleting it, then installing another etc.?

You could install each in a different MIX_HOME. And switch to those when using different versions.

1 Like

Oh, so this is like Ruby’s gemsets and OCaml’s OPAM’s switches? Cool, at least there’s a good workaround, thank you.

There‘s https://www.phoenixdiff.org/ for that as well.


But that’s just comparing different Phoenix versions?

EDIT: I am after comparing a project freshly generated by Phoenix’s generator, and an in-progress project that was earlier generated by the same version of the generator.

It seems that a little better granularity (and I suppose less file waste) can be achieved by utilizing the MIX_ARCHIVES env var, I’ll experiment and report back.


Confirmed that using the following commands yields slightly different projects and thus it can be used to “sandbox” using various mix archive-related commands (like phx.new and many others):

MIX_ARCHIVES="$HOME/.mix_phoenix-1.5.5" mix archive.install hex phx_new 1.5.5
mkdir ~/demo155
cd ~/demo155
MIX_ARCHIVES="$HOME/.mix_phoenix-1.5.5" mix phx.new demo

MIX_ARCHIVES="$HOME/.mix_phoenix-1.5.6" mix archive.install hex phx_new 1.5.6
mkdir ~/demo156
cd ~/demo156
MIX_ARCHIVES="$HOME/.mix_phoenix-1.5.6" mix phx.new demo

Doing diff -ur ~/demo155/demo ~/demo156/demo only shows differences between the secret_key_base and signing_salt variables (both irrelevant here) and – voila! – there are differences in mix.exs:

-      {:phoenix, "~> 1.5.5"},
+      {:phoenix, "~> 1.5.6"},


-      {:phoenix_live_dashboard, "~> 0.2"},
+      {:phoenix_live_dashboard, "~> 0.3 or ~> 0.2.9"},

TL;DR: Using the MIX_ARCHIVES env var works perfectly for my goal.

Many thanks to @NobbZ for pointing me in the right direction.