ok, I was able to solve the issue.
If I specify just name and url for http_archive then my build failed with
no such package '@nlohmann_json//': BUILD file not found in directory '' of external repository @nlohmann_json. Add a BUILD file to a directory to mark it as a package. and referenced by
http_archive also needs strip_prefix to be defined in order to find BUILD.bazel file inside the archive)
Full working example of nlohmann_json for Bazel:
# WORKSPACE
http_archive(
name = "nlohmann_json",
# BUILD
cc_library(
name = "foo",
hdrs = ["foo.h"],
srcs = ["foo.cc"],
deps = [
"@nlohmann_json//:json",
],
)
Hope this resource is searchable and Google will index it