extend cc toolchain configurability, fix GCC on macOS #686
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for providing these rules for Nixpkgs.
This PR is largely driven by my desire to get a hermetic GCC toolchain on macOS and include the following changes:
cc.isClanginstead ofstdenv.isDarwinsupport_nixconstraint. This can be useful if some toolchains are provided by Nix and other toolchains are not..bazelrcfile can be problematic with a project that is building with many different versions of GCC and Clang as e.g.coptswill persist after a transition onextra_toolchains.Since
_nixpkgs_cc_toolchain_configusesunix_cc_toolchain_config, I need to disable themacos_default_link_flagsfeature as mentioned in this issue.I've only tested this with Bazel 8.2 and I haven't actually looked at any output with
bazel coverage. The supported keys forextra_toolchain_flagsare ones that I thought made sense but those could be changed.Here's a usage example which is based on the in-repo example: