Document how to deploy artifacts generated with Nix+Bazel
Is your feature request related to a problem? Please describe. Artifacts generated with Nix+Bazel may have a number of runtime dependencies: E.g. shared libraries residing in the Nix store, shared libraries residing in the Bazel output base, runfiles dependencies. To produce a deployable self-contained deployable we must make sure that all these runfile dependencies are bundled. This is not typically the case when we just naively copy the output files after building a given Bazel target.
Describe the solution you'd like Documentation on how to generate self-contained, ideally relocatable artifacts.
Additional context There are existing solutions to this problem out there:
- clodl can be used to produce some degree of self-contained artifacts.
- The Daml project uses
package_app(package-app.sh) to bundle shared library dependencies (including those from the Nix store) and produce a relocatable bundle. Investigate which of these (and perhaps others) make sense to reference in the documentation.
Oh weird this was opened 5 hours ago. I was just going to ask for ideas.
There's also the nix bundle command: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-bundle.html
I have been building and running in a singularity container, which makes cross system a little less painful- but a workable solution would be great.
@dmadisetti Nice, thank you for sharing! I had forgotten about that one. AFAIK it would still require extra care to bundle Bazel defined runtime dependencies.