We're making a nix-bazel-nix sandwich:
- Nix runs bazel to fetch all dependencies, then tars them and supply it as derivation to next step
- Nix builds the app (offline)
According to https://bazel.build/external/faq#how-do-i-prepare-and-run-an-offline-build this should work:
$ bazel clean
$ REGISTRY=$(mktemp -d)
$ git clone https://github.com/bazelbuild/bazel-central-registry.git "${REGISTRY?}"
$ REPO_CACHE=$(mktemp -d)
$ TARGET=//java/dev/enola/cli:enola_deploy.jar
$ bazel --batch fetch --repository_cache="${REPO_CACHE?}" --registry="file://${REGISTRY?}" "${TARGET?}"
< disconnect network >
$ bazel --batch build --nofetch --repository_cache="${REPO_CACHE?}" --registry="file://${REGISTRY?}" "${TARGET?}"
However on Nix this doesn't work at build:
> OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
> Computing main repo mapping:
> ERROR: Error computing the main repository mapping: error during computation of main repo mapping: to fix, run
> bazel fetch //...
> External repository @@bazel_tools not found and fetching repositories is disabled.
> Computing main repo mapping:
We're making a nix-bazel-nix sandwich:
According to https://bazel.build/external/faq#how-do-i-prepare-and-run-an-offline-build this should work:
However on Nix this doesn't work at
build: