Conversation
36ec144 to
2fcb1cb
Compare
7b1bc8b to
e9fbe58
Compare
|
Reporting that I've tried this and it seems to be working pretty well! Ping @NixOS/bazel as this seems to have gone unnoticed |
|
Same, I have been successfully using that on Linux & Darwin x86_64. I have one ask: can we add bash onto This will allow the sh rules to work, which I believe is a sensible thing to do, and I had to do it to use cerisier/toolchains_llvm_bootstrapped. Thanks for the work! |
This comment was marked as off-topic.
This comment was marked as off-topic.
I'd prefer to look into it separately after it gets merged, there could be multiple ways to make those rules work which needs some looking into first (long-term would be nice to convert most of current nixos patches to configuration options or patches on bazel side) Note: 8.3.0 is coming soon too but not released yet, that'll also be a folllow-up |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/5632 |
|
This can be merged I believe |
|
I don't have permissions to do that myself.. |
|
Hmm, excluding darwin from platforms didn't help with CI wait time, check on darwin is still pending. Maybe because it was previously requested on this PR? |
emilazy
left a comment
There was a problem hiding this comment.
Thanks for your work on this!
@boltzmannrain @hzeller Since the Bazel team appears to be inactive, how do you feel about adding yourselves to it (and considering dropping inactive maintainers from it)? The Bazel support in Nixpkgs could clearly use a lot of work and it would be good to have an active maintainer team for that. Being part of the team will also let you use the merge bot to merge PRs opened by @r-ryantm and by committers (though I imagine getting @r-ryantm to create automatic update PRs for this would require some passthru.updateScript engineering and some good fortune).
I realize that a committer to merge the changes is the bigger blocker here. I do not understand Bazel enough to feel qualified to give a truly thorough review of this, but the code does not scare me any more than the existing Bazel derivation, so I’m okay merging this once builds are verified. An update to the latest version would be great, but can come in a follow‐up PR. FWIW, it would be very nice to see this package become version‐generic rather than copy‐pasting, but it seems like the Bazel 8 build is different enough that a fresh start makes sense.
Hmm, excluding darwin from platforms didn't help with CI wait time, check on darwin is still pending. Maybe because it was previously requested on this PR?
ofborg will still try to queue things up on Darwin even if they’re marked as unsupported, because it only finds out that the package is unsupported once the queue entry runs. Unfortunately ofborg hasn’t gotten as much attention as it needs lately and the Darwin runners in particular are very overloaded. I can help verify a Darwin build if you remove the exclusion commit. You can ping @NixOS/darwin-maintainers for that kind of thing in future, too.
|
For latest release 4.0.0rc1 is there with release planned in couple days. I was thinking to keep this PR in ofborg queue, and maybe create a concurrent PR for newest version with darwin excluded so maybe it has better luck. But since ofborg will still queue builds it won't help then |
0feb4cf to
ebf9d44
Compare
|
Updated to use 8.4.0, this allowed to remove couple more patches. Applied other suggestions from comments here and from Gemini code assist from boltzmannrain#1 Keeping platforms = linux + darwin, on my machines all are building fine, and removing won't help skip the darwin queue anyway. |
|
For updates to Bazel maintainers team, there's also |
Following the suggestion from `bazel_8` PR NixOS#400941 (review) adding myself to Bazel maintainers team
The setup is based on bazel 5,6,7 in nixpkgs but is significantly different codeline-wise. There's a bit less patching, all patches are via patch files and other small tweaks. ## Bazel 8 build With 8.4.1 bazel dist archive is enough for air-gapped build removing the need for FODs or `src-deps.json`, and in turn we no longer need existing `bazel` binary to bootstrap the build. `enableNixHacks` patch is removed, `bazel-examples` repo is used as `passthru.tests` (cpp, java, rust) via new `bazel_8/build-support` helpers. `sed` patches are converted to patch files, overall amount of patching is reduced, if there'd be need for more it can be added with links to upstream issues or patches, ideally with a regression `passthru.tests` item. Amount of patching may potentially be reduced further, this needs more feedback using this. Overall using Bazel on NixOS remains tricky, for non-packaged repos it may still be most practical to use FHS + extra hacks and patches, maybe even straight up using Bazelisk and upstream pre-built binaries in FHS. ## buildBazelPackage support `pkgs/build-support/build-bazel-package/default.nix` is fairly big with a set of tweaks that may not be necessary with recent Bazel or may have better alternatives. More work is needed to figure out compatibility with `bazel_8` or other things to unify with `bazel_8` helpers. ## bazel_8/build-support Here are fairly minimalistic helpers to aid building Bazel packages using Bazel 8 features. For now only testes on `bazel-examples` repo. `patching.nix`: just a helper to inject patches into Bazel external dependencies `bazelDerivation`: helps to compose Bazel commandline and consume `repository_cache`, `vendor_dir`, `registry` all related to external dependencies management `bazelPackage`: two-stage derivation similar to `buildBazelPackage`, having options for `repository_cache` (pure fetches) or `vendor_dir` (unpacked fetches, further patchable)
ebf9d44 to
fae41a5
Compare
|
Please let me know how I can help to get this approved. |
|
I thought ofborg builds are required so was waiting for them to pass on macos, but looking at #424273 and that all Otherwise PR is now updated to latest 8.4.1 and I'm not aware of any merge blockers. |
|
Ignore the Ofborg darwin/macos builds, those usually take forever. |
|
|
emilazy
left a comment
There was a problem hiding this comment.
Thanks for sticking with this work! Hope this can help improve the Bazel + Nix situation :)
The setup is based on bazel 5,6,7 in nixpkgs but is significantly
different codeline-wise. There's a bit less patching, all patches
are via patch files and other small tweaks.
Bazel 8 build
With 8.4.1 bazel dist archive is enough for air-gapped build removing
the need for FODs or
src-deps.json, and in turn we no longer needexisting
bazelbinary to bootstrap the build.enableNixHackspatch is removed,bazel-examplesrepo is usedas
passthru.tests(cpp, java, rust) via newbazel_8/build-supporthelpers.
sedpatches are converted to patch files, overall amount of patchingis reduced, if there'd be need for more it can be added with links
to upstream issues or patches, ideally with a regression
passthru.testsitem.
Amount of patching may potentially be reduced further, this needs
more feedback using this.
Overall using Bazel on NixOS remains tricky, for non-packaged repos
it may still be most practical to use FHS + extra hacks and patches,
maybe even straight up using Bazelisk and upstream pre-built binaries
in FHS.
buildBazelPackage support
pkgs/build-support/build-bazel-package/default.nixis fairly bigwith a set of tweaks that may not be necessary with recent Bazel
or may have better alternatives. More work is needed to figure
out compatibility with
bazel_8or other things to unify withbazel_8helpers.
bazel_8/build-support
Here are fairly minimalistic helpers to aid building Bazel packages
using Bazel 8 features. For now only testes on
bazel-examplesrepo.patching.nix: just a helper to inject patches into Bazel externaldependencies
bazelDerivation: helps to compose Bazel commandline and consumerepository_cache,vendor_dir,registryall related to externaldependencies management
bazelPackage: two-stage derivation similar tobuildBazelPackage,having options for
repository_cache(pure fetches) orvendor_dir(unpacked fetches, further patchable)
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.