Specific Version of Bazel that is not available in nixpkgs

I am using flakes for my project. I tried to add bazel as a dependency to my devShell because tensorflow-rs requires bazel for building. However, tensorflow-rs depends on a specific (5.3.0) version of bazel which is not available on nixpkgs (even on older commits, checked here: Nix Package Versions). I saw the source for the bazel package defined in nixpkgs here (https://github.com/NixOS/nixpkgs/blob/737bde6fb2ddd8ecfea8b89b5a17d1954620ce35/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix) and i can see that the version is specified as a variable which is then pulled from github. How do i apply a “patch” to the nixpkgs (as an overlay maybe) so that it uses the version i want?

The available 5.4.1 version doesn’t work as I get an error while building tensorflow.

ERROR: The project you're trying to build requires Bazel 5.3.0 (specified in /Users/xyz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tensorflow-sys-0.24.0/target/source-v2.13.0/.bazelversion), but it wasn't found in /nix/store/84vswsh0hb3nv6i8iqjx6kn3ssry1bc6-bazel-5.4.1/bin.
1 Like