-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add awk as a default tool for Bazel shell commands. #50765
Conversation
It is part of our stdenv so that should be fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
IMO we should patch Bazel to respect PATH properly. But I suppose this is okay as a fix for now. |
@matthewbauer I don't think so. The rule actions are not meant to depend on just anything that happens to be found on the |
But, there's no way to specify what software you're using. Nix can handle this for you, but only if you don't clear the PATH variable. I think the idea that clearing PATH somehow makes things more reproducible is kind of silly. You could have /usr/bin filled with nonstandard binaries in the same way you could fill PATH with nonstandard directories. Assuming all of these commands exist in /usr/bin is breaking portability to not only NixOS but also BSDs where GNU tools are conventionally put in /usr/local/bin. Nix* ecosystem has been working for a long time to prevent tools from hardcoding /usr/bin/ paths. It's really annoying that Bazel seems to go out of its way to hardcode these paths. At the least, we need some way to override this annoying behavior for non-FHS systems. |
I think you're misunderstanding how Bazel uses For those few tools that Bazel wants to find in |
A question since this is my first nixpkgs PR. Am I expected to tick off all checkboxes? |
After running into |
This is indeed the intended policy. |
By patching you mean replacing |
@robinp I mean neither. Bazel rule sets assume that a few small utilities will be available at known locations somewhere on the host (not in the source repo). Those small utilities can indeed be found on a NixOS system - just at different known locations. See the derivation for the Bazel package. It simply replaces |
On above SO question I got pointed to bazelbuild/bazel#5265, which is now temporary stalled, but acknowledges that the set of "small utilities" is not well defined. We can keep adding implicit tools used in Bazel rules to the Nix derivation, but I suspect there needs to be a cutoff. Without doing some hard-core grepping on big public Bazel repos, I don't know for example if Or, a different point of view could be, if a tool is likely to be present in a baseline Nix install (if there's such), it's ok to be included in the derivation. |
I don't think it's reasonable to include Git, nor Bison and flex. Where did you encounter those? |
Found in Kythe repo. Git is called in I agree Maybe there could be a |
Apparently https://github.com/gflags/gflags/blob/e292e0452fcfd5a8ae055b59052fc041cbab4abf/bazel/gflags.bzl#L8 assumes it should be accessible. Normally we could ask them to fix, but I would expect awk to be a commonly assumed. The rough search https://github.com/search?q=filename%3ABUILD+genrule+awk&type=Code brings ~1K hits.
@Profpatsch anything further to do in this PR? |
@Mic92 I don't think there's anything apart from maybe checking more tickboxes at the top. But these seem quite mysterious to me (first time nixpkgs PR), the only one I tried
Given the simplicity of the change maybe it is not needed to tick those, but up to you to say. |
@robinbb try |
Result of nix-review pr 50765 2 package failed to build:1 package were build:
However the error shown seems to be not related to this change. |
Thanks for the reminder, forgot about this. |
Apparently
https://github.com/gflags/gflags/blob/e292e0452fcfd5a8ae055b59052fc041cbab4abf/bazel/gflags.bzl#L8
assumes it should be accessible. Normally we could ask them to fix, but
I would expect awk to be a commonly assumed.
The rough search
https://github.com/search?q=filename%3ABUILD+genrule+awk&type=Code
brings ~1K hits.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)