This is mostly based on a Slack discussion, but I believe it's better suited here.
I recently tried to build my first "custom" nerves system from my Mac, and while I appreciate the effort it has gone into making it a smooth experience, it still has a lot of warts.
In my experience it's mostly about Buildroot, and not particularly about nerves.
The suggestion I received on Slack is that Docker for Mac is not very well suited for this purpose, since you can't easily access the docker filesystem or cache the build artefacts etc etc. I therefore moved to an Ubuntu VM.
@fhunleth said on Slack:
I'm not sure how many others do this, but I avoid building systems with
mix. My workflow is to checkout both
nerves_system_br and the custom system, run
create_build.sh to create a build directory and then run
make in the build directory. To use the custom system, I source the
./nerves-env.sh from the build directory. It sets the
NERVES_TOOLCHAIN environment variables which when you go to build your Elixir project will cause it to use your custom system instead.
I have a couple utility scripts to automate this slightly since I work with about 10 custom systems and sometimes I like to build them all.
This setup also allows me to have a global download directory to avoid redownloading things.
I hope others knowledgable with nerves will contribute to this post so that it can serve as interim documentation!