You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/bin/bash is unavailable on NixOS by default. This breaks many bazel
assumptions and causes build failures such as:
```
...
process-wrapper-legacy.cc:80: "execvp(/bin/bash, ...)": No such file or directory
...
```
By unsetting `incompatible_strict_action_env` [0], conditionally (on
NixOS) setting `shell_executable` [1] to the bash in the Nix store, and
by setting the `bazel-wrapper` PATH with
`writeShellApplication.runtimeInputs` we are able to avoid these errors.
Finally, tag several targets in //example as "manual" so they are not
automatically built with the host toolchain, since this currently fails
on NixOS. This should be addressed in a follow-up commit.
Testing was performed using nixpkgs supplied bazelisk [3] on Luke
Peterson's and Michael Schneider's NixOS machines. This itself presented
issues, as this package is documented with `BEWARE: This package does
not work on NixOS.` Out of the box this is true, but can be worked
around with `programs.nix-ld.enable = true` [4] in `configuration.nix`.
Special thanks to Oliver Lee and Michael Schneider during the final day
of Nixcademy NixOS training. This was a great collaboration!
[0]:
https://bazel.build/reference/command-line-reference#flag--incompatible_strict_action_env
[1]:
https://bazel.build/reference/command-line-reference#flag--shell_executable
[2]:
https://nixos.org/manual/nixpkgs/unstable/#trivial-builder-writeShellApplication
[3]:
https://github.com/NixOS/nixpkgs/blob/nixos-25.05/pkgs/by-name/ba/bazelisk/package.nix
[4]: https://github.com/nix-community/nix-ld
0 commit comments