Elixir 1.10 umbrellas changed how they handle loading the Mix configuration.
In Elixir <= 1.9.x umbrella applications Mix config would point the config to
config_path: "../../config/config.exs" which in turn would load the
apps/*/config/config.exs files. This configuration often led to problems due to the way that Nerves interfaces with Mix. Its a common pattern that when compiling for a target you have an explicit configuration file that can be the final override. In our projects, this is the
config/target.exs file, by default it is evaluated last. In umbrellas, the
app/*/config/config.exs files would be evaluated in alphabetical order, which was confusing. With Elixir <= 1.10.0, the
config/config.exs file in the top of the umbrella no longer references the individual apps, but this lends itself to a new problem, how do we package the nerves specific config files with the new project generator without clobbering the umbrella config with required configuration.
I think the right answer here is to update the new project generator to not change the location of
config_path in the Mix config and always point to the included config. I’ve always struggled to find value in using a Nerves app in an umbrella. In addition to the config, a big complication is the use of Mix aliases. Nerves uses Mix aliases to bootstrap the environment for cross compilation. The issue is that Mix aliases are only invoked for the top level mix project, meaning, all mix commands that are run at the top of the umbrella would not invoke
nerves_bootstrap, and you would therefore have to
cd to the app dir. Alternatively, the aliases could be added to the umbrella’s
mix,exs file, but that would then have an opposite effect where all apps would be cross compiled (native code).