-
Notifications
You must be signed in to change notification settings - Fork 3
Fix NixOS specific build issues #60
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
Conversation
|
@m1-s thank you for all your help on this! @oliverlee and I hacked on it for a few more hours after class and came up with a different strategy that seems to avoid a corner case we hit after class (and at this hour, I can't even remember what it was, but it was 🤯). If you have the time and inclination, we'd love to have your feedback but no worries if not! Thank you again! |
5577970 to
69aa51e
Compare
|
The nix store path was only valid for linux-x86_64, so this would fail on other systems (e.g. darwin-aarch64). |
oliverlee
left a comment
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.
Maybe update the develop section of the readme with NixOS config requirements.
It looks like forks don't have access to secrets. I'll try and fix that this weekend unless you do it before I do.
69aa51e to
e08694d
Compare
Please take a look at how I did this and try on darwin-aarch64 to make sure you get an empty |
|
Thanks! No See inline comments and you'll need to sign your commit: |
Does bazelisk run //tools:format work for you? I'm getting the following error in my NixOS VM:
INFO: Running command line: bazel-bin/tools/format.bash
/home/builder/.cache/bazel/_bazel_builder/98502806d288a25787a2b73a84a8c1a8/execroot/_main/bazel-out/aarch64-fastbuild/bin/tools/format.bash: line 19: /home/builder/.cache/bazel/_bazel_builder/98502806d288a25787a2b73a84a8c1a8/execroot/_main/bazel-out/aarch64-fastbuild/bin/tools/format.bash.runfiles/rules_multirun+/internal/multirun: cannot execute: required file not found
|
The target is defined by the |
f842c24 to
834ebd5
Compare
/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
834ebd5 to
6707a64
Compare
/bin/bash is unavailable on NixOS by default. This breaks many bazel assumptions and causes build failures such as:
By unsetting
incompatible_strict_action_env0, conditionally (on NixOS) settingshell_executable1 to the bash in the Nix store, and by setting thebazel-wrapperPATH withwriteShellApplication.runtimeInputswe 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 withprograms.nix-ld.enable = true4 inconfiguration.nix.Special thanks to Oliver Lee and Michael Schneider during the final day of Nixcademy NixOS training. This was a great collaboration!