This is based on nixpkgs
commit 862277ac9d34273cd953f42061e23d488d6b7e8b.
The resulting image is less than 25 MiB compressed.
The actual crosslink
closure got shrunk from ~180 MiB to ~60 MiB just by using beam_minimal
rather than beam
as the base set in beams.nix
!
Oh, wait!
This is as expected!
The "minimal" Erlang is indeed ~300 to 350 MiB in its closure size ("full" is about twice), only the final applications closure will actually benefit from the partially copied OTP. As that then will only copy relevant OTP-apps.
In hindsight, using
beam_minimal
andbeam_nox
is not to removewx
, as the application will be built anyway, but no hard linking to the wx libraries happens.The actual reason for using
beam_minimal
is to exclude systemd from the closure, which would be kept referenced in the final closure otherwise due to it being "wrapped" into the EPMD for which I have so far not found a way to exclude.So for checking the size of your deployment, please build the final closure and check its size, not the intermediate erlang artifact, for which we take steps to get rid of it anyway.
If the final closure though still exceeds your expectations, further debugging has to be done on that.