-
-
Notifications
You must be signed in to change notification settings - Fork 223
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 nixos support #182
Add nixos support #182
Conversation
@lromor Hi! Can you share the example workspace you're using or provide a little more context about the target you're building that leads to the error? I'm a little confused; the error seems unrelated to
|
re NixOS support: this is something I'd very much like to see in The LLVM releases that [nixos@nixos:~/clang+llvm-15.0.6-aarch64-linux-gnu]$ ldd bin/clang
linux-vdso.so.1 (0x0000ffff9ba4c000)
libpthread.so.0 => /nix/store/g14swv4f0rg83naqj87g1mjmyvrmrxmf-glibc-2.35-163/lib/libpthread.so.0 (0x0000ffff92f10000)
librt.so.1 => /nix/store/g14swv4f0rg83naqj87g1mjmyvrmrxmf-glibc-2.35-163/lib/librt.so.1 (0x0000ffff92ee0000)
libdl.so.2 => /nix/store/g14swv4f0rg83naqj87g1mjmyvrmrxmf-glibc-2.35-163/lib/libdl.so.2 (0x0000ffff92eb0000)
libm.so.6 => /nix/store/g14swv4f0rg83naqj87g1mjmyvrmrxmf-glibc-2.35-163/lib/libm.so.6 (0x0000ffff92e00000)
libz.so.1 => not found
libtinfo.so.6 => not found
libstdc++.so.6 => not found
libgcc_s.so.1 => /nix/store/g14swv4f0rg83naqj87g1mjmyvrmrxmf-glibc-2.35-163/lib/libgcc_s.so.1 (0x0000ffff92dd0000)
libc.so.6 => /nix/store/g14swv4f0rg83naqj87g1mjmyvrmrxmf-glibc-2.35-163/lib/libc.so.6 (0x0000ffff92c20000)
/lib/ld-linux-aarch64.so.1 => /nix/store/g14swv4f0rg83naqj87g1mjmyvrmrxmf-glibc-2.35-163/lib/ld-linux-aarch64.so.1 (0x0000ffff9ba0f000)
[nixos@nixos:~/clang+llvm-15.0.6-aarch64-linux-gnu]$ !$
bin/clang
-bash: bin/clang: No such file or directory (note that some of the libraries in the above are resolved because NixOS preloads some libraries in the ld so cache) Ultimately this means that to use upstream LLVM releases on NixOS, I think our options are:
Alternatively we could look into procuring LLVM releases for NixOS from other sources:
I think the first option is the least bad in terms of user experience but it is complex. The third option is the simplest to implement (just distro checking and some docs and error messages) and is perhaps in line with how NixOS users use I'm willing to help implement and test any of the above but I think @siddharthab should chime in with what's actually in scope for |
Sure thing: I'm also a bit confused, I just used the README quickstart:
and added to .bazelrc:
I'm a bit confused here, without the flag
with the flag I get:
Standard rules_cc. Regarding the nixos proposal, thank you for answering in such a detailed manner. I understand the issues. I'll wait for the repo owners to make a decision on what would be in their opinion the way to go if any. |
Anyways, give me some time for the first issue. I'll try to reproduce it on a minimial project and get back to you! |
Is this still being worked on? |
No, didn't have time for it. But, for posterity, I figured out by passing the variables NIX_LD and NIX_LD_LIBRARY_PATH via
works well for most bazel-pulled precompiled stuff. In this way there's no need for changes in the toolchain. What do you think? |
Thanks for getting back on this. Yes, I think that should be good enough. nix is ultimately just setting up an environment through environment variables. Technically, you can also run bazel under nix, or there might be better integration setups under https://nix-bazel.build/. |
Sorry to reopen @siddharthab.
I would love to streamline this setup! |
Hi @lromor, unfortunately I am no longer active in this repo. Please ask one of the active maintainers to help. Thank you for taking this forward. |
@fmeum maybe? |
Happy to review PRs, just keep in mind that I know nothing about Nix ;-) |
Hi!
I would like to work on adding support to nixos. Toghether with this introductory PR, I have a quick question. On of the issues I have now when using the latest toolchain is:
Do tou have any clues on how to fix this? Is it something fixable in the repo or does it require I wrap cc_* rules with my own that uses the default_toolcain() function?