Commit graph

50 commits

Author SHA1 Message Date
Peder Bergebakken Sundt
c77ac9dfc3 treewide: fix typos 2025-06-02 16:07:07 +02:00
Fernando Rodrigues
05580f4b44
treewide: switch instances of lib.teams.*.members to the new meta.teams attribute
Follow-up to #394797.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
2025-04-25 22:20:17 -03:00
Randy Eckenrode
5d09f1a60c
bazel_{5,6,7}: get libc++ headers on Darwin from stdenv.cc.libcxx 2025-04-18 19:06:37 -04:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Samuel Ainsworth
f638e0b4c4 bazel_{5,6,7}: add meta.mainProgram 2025-03-16 00:54:57 -04:00
Sigmanificient
91d5ab3ae4 treewide: remove unused rec expressions 2025-03-14 05:15:05 +01:00
Wolfgang Walther
b19d0f6d3d
treewide: replace substituteAll with replaceVars 2025-02-10 22:51:56 +01:00
Weijia Wang
2e4aa2b7ab bazel_6: use new apple sdk pattern 2025-01-03 18:35:53 +01:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
Sigmanificient
63d05d989e pkgs/development: remove unused arguments 2024-08-03 17:18:20 +02:00
Sigmanificient
203a48ad35 pkgs/development: remove unused fetchpatch arguments 2024-05-24 02:53:57 +02:00
Claudio Bley
78f4d9fb5c DBG: change name of tests so it is clear if hacks are enabled 2024-04-09 09:35:30 +02:00
Claudio
4f857cd1de bazel_6: Enable local networking for tests on Darwin 2024-04-08 16:40:32 +02:00
Claudio Bley
a75d0a734f bazel_6: Add sigtool and set up codesign allocate appropriately 2024-04-08 16:40:31 +02:00
Claudio
bb8574ddb8 bazel_6: Add patch for system sleep on Darwin
This re-uses the same patch as bazel_7 which indeed is also necessary here, since
otherwise building bazel_6 failed with

```
FATAL: CHECK failed: (success) == (0):
```

at d839db66ee/src/main/native/darwin/sleep_prevention_jni.cc (L39)
2024-04-08 16:40:31 +02:00
Claudio Bley
bccdc6751f bazel_6: Skip building the execlog parser on darwin
This currently fails with:
```
       > ERROR: /private/var/tmp/_bazel__nixbld1/e8e960336b6dc72b41250252f59936ca/external/remote_java_tools/java_tools/zlib/BUILD.bazel:18:11: Compiling java_tools/zlib/uncompr.c [for tool] failed: The include path '/nix/store/z0nnwdh4p692yvf3qgwgj3bn78w99q6y-python3-3.11.6/include' references a path outside of the execution root.
       > ERROR: /private/var/tmp/_bazel__nixbld1/e8e960336b6dc72b41250252f59936ca/external/remote_java_tools/java_tools/zlib/BUILD.bazel:18:11: Compiling java_tools/zlib/zutil.c [for tool] failed: The include path '/nix/store/z0nnwdh4p692yvf3qgwgj3bn78w99q6y-python3-3.11.6/include' references a path outside of the execution root.
       > Target //src/tools/execlog:parser_deploy.jar failed to build
```
2024-04-08 16:40:31 +02:00
Claudio Bley
6528de1a4f bazel_6: Add check to assert GSON serialization works
See https://github.com/NixOS/nixpkgs/issues/273500
2024-04-08 16:40:31 +02:00
Claudio Bley
7cb1b52dbf bazel_6: 6.4.0 -> 6.5.0 2024-04-08 16:40:31 +02:00
Uri Baghin
8c7c922cc7
Merge pull request #231839 from divanorama/bazel_watcher-0.23.1
bazel-watcher: 0.21.2 -> 0.23.1
2024-01-04 12:20:28 +08:00
Dmitry Ivankov
ed175a635e bazel_6: fix CLang 16 Werror-s on darwin
bazel_6 https://hydra.nixos.org/build/241090720/nixlog/1
```
external/upb/upb/upb.c:228:25: error: defining a type within '__builtin_offsetof' is a Clang extension [-Werror,-Wgnu-offsetof-extensions]
  n = UPB_ALIGN_DOWN(n, UPB_ALIGN_OF(upb_Arena));
                        ^~~~~~~~~~~~~~~~~~~~~~~
```
bazel_6 https://hydra.nixos.org/build/241127779/nixlog/1
```
In file included from external/com_google_absl/absl/algorithm/container.h:55:
external/com_google_absl/absl/meta/type_traits.h:560:8: error: builtin __has_trivial_assign is deprecated; use __is_trivially_assignable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_assign(ExtentsRemoved) || !kIsCopyOrMoveAssignable) &&
       ^
```

Note: `bazel_5` and `bazel_4` require more work, for some reason extra
`-Wall` in combination with `-Werror` sneaks in and overrides `-Wno-`
settings, haven't managed yet to debug where exactly are the last
flags (last one wins) come from there.

ZHF: #265948
2023-11-22 22:53:47 +01:00
Dmitry Ivankov
dd85449211
Update pkgs/development/tools/build-managers/bazel/bazel_6/default.nix
Co-authored-by: Uri Baghin <uri@canva.com>
2023-11-20 02:13:23 +01:00
Dmitry Ivankov
7377bba1c7 bazel_6: fix: make patched bash a native binary
https://hydra.nixos.org/build/240805256/nixlog/1
https://hydra.nixos.org/build/240805170/nixlog/2
Failure is a bit obscured but long story short, a script within
bazel gets custom nixpkgs shebang which in turn makes shell run
in POSIX-compatible mode. Bazel expects bash in non-POSIX mode
and osx-specific script starts to fail due to `set -e` and subshell
interaction differences in those modes (sub-shells and functions
suddently start inheriting `set -e` and fail to produce desired
output). More debug info is available in #267670

Shell scripts aren't guaranteed to work as interpreters in shebang.
In particular thin shell wrappers aren't shebang-ready on MacOS.
It may work sometimes depending on what exactly would try to execute
a script with such shebang, but generally it's not guaranteed to work.
See #124556

Bash wrapper was introduced in #266847 and so far seems like the
issue only affects darwin builds: hydra failure is in osx-specific
script, also shebang issue is usually darwin-specific.

Let's wrap it as a native binary to make it shebang-compatible.

The wrapper is only currently added to `bazel_6` so no need for
changes in other versions.

ZHF: #265948
2023-11-20 02:02:39 +01:00
Malte Poll
b1dcea4773 bazel: use bash with fallback $PATH consisting of basic shell utils
Second iteration of this change.
First attempt did not ensure `bashWithDefaultShellUtils` is available at runtime.
2023-11-11 13:22:20 +01:00
Bjørn Forsman
7e41495103 Revert "bazel: use bash with fallback $PATH consisting of basic shell utils"
This reverts commit 3576806d7e.

It broke python311.pkgs.jaxlib, see
https://github.com/NixOS/nixpkgs/pull/265041#issuecomment-1806784693.
2023-11-11 12:34:28 +01:00
Malte Poll
3576806d7e bazel: use bash with fallback $PATH consisting of basic shell utils 2023-11-11 00:25:53 +01:00
Claudio Bley
932ee614a4 bazel_6: 6.3.2 -> 6.4.0 2023-10-26 08:28:19 +02:00
Claudio Bley
73654d2367 bazel_6: Remove .bazelversion file in the updater sources 2023-10-26 08:28:19 +02:00
Harsh Modi
a8f616d11c bazel_6: Add diffutils and gnupatch to initialEnvironment
Nix's version of bazel has custom patches to make bazel more hermetic when used with nix. One of those is limiting the default
environment of Bash. However, this default environment is insufficient because lots of programs rely on diff being in the path like buildifier, golangci-lint, and other things since golang diff implementations aren't very good.

Ideally we'd include "diffutils" as part of this list for rules that assume the presence of "diff" and don't allow nice knobs to configure otherwise.

Furthermore, bazel has a lot of internal facilities that utilize patch (like when downloading workspaces, we have the option of patching them), so include gnupatch as well.

Fixes #249846
2023-09-12 10:14:31 -07:00
Jacob Foard
af3759f264
bazel_6: 6.2.0 -> 6.3.2 2023-08-16 16:15:21 -04:00
Uri Baghin
63c7774d20
Merge pull request #245860 from dmivankov/patch-4
bazel_6: installCheckPhase .bazelversion override
2023-08-15 11:09:42 +10:00
Dmitry Ivankov
5790912514 bazel_6: installCheckPhase .bazelversion override
In case bazel dist archive includes .bazelversion (like in 5.4.1 https://github.com/bazelbuild/bazel/issues/18189 or 6.3.1rc1) running bazel commands in dist worktree will require using version specified in .bazelversion. If .bazelversion is absent there any available version will be used.

Let's make sure we don't fail installCheckPhase for dist archives that do include .bazelversion (note: bazel bootstrapping from sources not via bazel works regardless of that file, so that's only about test/check phases)
2023-08-14 10:16:17 +02:00
Dmitry Ivankov
ecbebc9e22
bazel_6: fix typo on comments
Leftover bazel_5 reference ffrom 5->6 update
2023-07-28 13:37:15 +02:00
Felix Buehler
6672dde558 treewide: use optionalAttrs instead of 'else {}' 2023-06-25 11:01:34 -03:00
Dmitry Ivankov
0d8594ef0d bazel-watcher: 0.21.2 -> 0.23.1
Changelogs:
https://github.com/bazelbuild/bazel-watcher/releases

Removing patch for https://github.com/bazelbuild/rules_go/issues/3408
because now it should be included in newer `rules_go` transitive
dependency.

Also removing `bazel-watcher` from `bazel_*` builds because it is
always using `bazel_5` and also [bazel-watcher](https://github.com/bazelbuild/bazel-watcher)
`is not an official Google product` so maybe not the best choice
for tests + there are some built-in tests in `examples/*` in bazel
builds. As suggested in https://github.com/NixOS/nixpkgs/pull/231439#issuecomment-1546467559
2023-05-14 14:26:30 +02:00
Dmitry Ivankov
5a14400712 bazel_6: 6.1.2 -> 6.2.0
https://github.com/bazelbuild/bazel/releases/tag/6.2.0
2023-05-12 15:33:48 +02:00
Dmitry Ivankov
cce9228342 bazel_6: fix darwin build
Since bazel 6.1.0 there was a change in `install_name_tool` invocation
on darwin: `/usr/bin/install_name_tool` -> `/usr/bin/xcrun install_name_tool`
https://github.com/bazelbuild/bazel/pull/17253

So interception of `install_name_tool` broke and build in nixpkgs became
less hermetic. It was either picking up host `xcode` or failing if
xcode isn't installed.

Let's update patching script in nixpkgs.

For errors like https://hydra.nixos.org/build/219158800/nixlog/3
```
ERROR: /private/tmp/nix-build-bazel-6.1.2.drv-0/bazel_src/examples/cpp/BUILD:13:8: Linking examples/cpp/hello-success_test failed: (Exit 1): cc_wrapper.sh failed: error executing command (from target //examples/cpp:hello-success_test)
  (cd /private/tmp/nix-build-bazel-6.1.2.drv-0/_bazel__nixbld12/bee562cde99c3bcadaa4e82f18c698fe/sandbox/processwrapper-sandbox/44/execroot/io_bazel && \
  exec env - \
    PATH=/nix/store/v6f6y9mwmqj9v1jffiy4g96ili4pj5la-python3-3.10.11/bin:/nix/store/mda7jac839k0z33n80pglkhfk3s8panz-unzip-6.0/bin:/nix/store/r9ynkgvbn9lp0x3dvrhr0dskss8wwhc2-which-2.21/bin:/nix/store/1jfsv6gcw2lzzavr3jhydzlmpy3iw9b7-zip-3.0/bin:/nix/store/w66qbvdwgpgbn3ikwyxkhpx1zwaw5rln-cctools-port-973.0.1/bin:/nix/store/99xl1hg0pvscfn7aszp0df034jnprn0j-clang-wrapper-11.1.0/bin:/nix/store/ngbj0z5mr5z7dhi0q11csq1k7rxvfcf7-clang-11.1.0/bin:/nix/store/lhbkcjmrv547plyiybfxqddlpn2l13yl-coreutils-9.1/bin:/nix/store/72fxghdpx8732zizx6jg5d74kblpz7ic-cctools-binutils-darwin-wrapper-973.0.1/bin:/nix/store/qm48dbbhmqk70hm35s9hzbmgvwd6slvs-cctools-binutils-darwin-973.0.1/bin:/nix/store/dv87q4384pyhg8f0hkw3l4lgkiqxwk94-zulu11.48.21-ca-jdk-11.0.11/bin:/nix/store/1alnbw2p2s4wfk3j52mxrbwvcrwh8c1b-bash-5.2-p15/bin:/nix/store/shzh26kvfirgl441lkv7vcw9lgylrgy7-file-5.44/bin:/nix/store/4dzdpald6db495rflbwfldvzn0vaqp7k-findutils-4.9.0/bin:/nix/store/2k3k7wg1azk8mr3393aj8xxj5pv3098r-gawk-5.2.1/bin:/nix/store/3whcyzf1r7cvjx30mfdy6h3krnvfd176-gnugrep-3.7/bin:/nix/store/8j0jryir74m945154zxw3zs17ig51v89-gnused-4.9/bin:/nix/store/0zy67qd1vd6643p0p6hw93kikz11lbml-gnutar-1.34/bin:/nix/store/79617rkc430q3rm6v4c5fs2raixq43qi-gzip-1.12/bin:/nix/store/lhbkcjmrv547plyiybfxqddlpn2l13yl-coreutils-9.1/bin:/nix/store/4dzdpald6db495rflbwfldvzn0vaqp7k-findutils-4.9.0/bin:/nix/store/6fx4a1125c3xfs7alrr0jlyh5cwkshz8-diffutils-3.9/bin:/nix/store/8j0jryir74m945154zxw3zs17ig51v89-gnused-4.9/bin:/nix/store/3whcyzf1r7cvjx30mfdy6h3krnvfd176-gnugrep-3.7/bin:/nix/store/2k3k7wg1azk8mr3393aj8xxj5pv3098r-gawk-5.2.1/bin:/nix/store/ym7jyaml2zj2x6y6mriyh6ch8z5abqr1-gnutar-1.34/bin:/nix/store/79617rkc430q3rm6v4c5fs2raixq43qi-gzip-1.12/bin:/nix/store/m8yqab399pakajchm99nq42qdcxiw1n0-bzip2-1.0.8-bin/bin:/nix/store/iiasa4fvs0d5ijj0qbj9nl7p31bznxah-gnumake-4.4.1/bin:/nix/store/1alnbw2p2s4wfk3j52mxrbwvcrwh8c1b-bash-5.2-p15/bin:/nix/store/w9x4wz6i8y7cy8hfvp5is86fyh2bh6cp-patch-2.7.6/bin:/nix/store/kx2n8m3j2pfq0v9jydav1qpdy1fd22im-xz-5.4.2-bin/bin:/nix/store/41qmp6qwwz3vvf94pccqnvcx1zdp5z9i-file-5.44/bin \
    PWD=/proc/self/cwd \
  external/local_config_cc/cc_wrapper.sh @bazel-out/darwin-fastbuild/bin/examples/cpp/hello-success_test-2.params)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
xcode-select: error: No developer tools were found and no install could be requested (perhaps no UI is present).
If developer tools are located at a non-default location on disk, use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools.
Use `xcode-select --install` to install the standalone command line developer tools, or visit http://adc.apple.com to download Xcode or the standalone command line tools installation package.
See `man xcode-select` for more details.
```
2023-05-12 11:21:37 +02:00
Dmitry Ivankov
389c519486 bazel_6: 6.1.1->6.1.2
All changes seem to be within bazel sources so `updater` script
doesn't produce changes to srcDeps.

https://github.com/bazelbuild/bazel/releases/tag/6.1.2
2023-04-21 13:31:42 +02:00
Dmitry Ivankov
f320081439 bazel_6: 6.1.0 -> 6.1.1
https://github.com/bazelbuild/bazel/releases/tag/6.1.1
2023-03-21 15:59:38 +01:00
Dmitry Ivankov
be9859e899 bazel_6: 6.0.0 -> 6.1.0
Updating the updater script:
- `//external:all` -> `//external:*` to make it work with recent bazel versions

Avoiding chicken-egg problem by explicitly asking to first build previous version,
then update sources version, then use updater and previous version to update src-deps.

`bazel_self` may not necessarily build out of the box after just the sources version
bump and may depend on updater being run first, which can't run without `bazel_self`.
So listing steps to use old version to help updating to new version
2023-03-07 17:01:57 +01:00
Uri Baghin
81dc5ee425 bazel_3: remove 2023-02-02 13:03:36 +11:00
Uri Baghin
ec57cb615b bazel_6: 6.0.0-pre.20220720.3 -> 6.0.0 2023-01-18 08:53:53 +11:00
zowoq
ae50f0678a
Revert "bazel_6: 6.0.0-pre.20220720.3 -> 6.0.0" 2023-01-11 10:01:46 +10:00
Albert Lloveras
bc66db939a PR feedback 2023-01-10 20:11:59 +11:00
Albert Lloveras
1e72427803 bazel_6: 6.0.0-pre.20220720.3 -> 6.0.0 2022-12-20 19:22:06 +11:00
Robert Schütz
d6ecfa2b1a bazel_6: only use python3 2022-11-24 23:04:27 -08:00
Guillaume Maudoux
b4f4f49331 bazel_6: Cleanup leftover comments 2022-09-02 12:54:36 +02:00
Uri Baghin
69c21d5bff bazel_6: fix darwin build 2022-08-23 19:24:07 +10:00
Guillaume Maudoux
095a37e13e bazel_6: Working fix for java toolchain on linux 2022-08-16 12:04:27 +02:00
Guillaume Maudoux
fff3c3b7a7 WIP v2 2022-08-12 17:04:44 +02:00
Guillaume Maudoux
882d0a3b7a bazel_6: init with a WIP implem 2022-08-11 15:33:28 +02:00