Skip to content
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

rustc: wrap llvmPackages when using LLVM with callPackage #330754

Merged
merged 1 commit into from
Aug 4, 2024

Conversation

RossComputerGuy
Copy link
Member

Description of changes

CC @trofi

Use callPackage with pkgsLLVM.rustc.llvmPackages so it fixes eval with Firefox, Betterbird, etc.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Jul 29, 2024
@trofi
Copy link
Contributor

trofi commented Jul 29, 2024

How did you test the eval? Maybe I'm doing it wrong. It fails for me as:

$ nix eval github:NixOS/nixpkgs/pull/330754/head#pkgsLLVM.betterbird-unwrapped
error:
       … while calling a functor (an attribute set with a '__functor' attribute)
         at /nix/store/7fzm97kg6m5nh0623wx1b5h45n6g05g0-source/lib/customisation.nix:264:13:
          263|     in if missingArgs == {}
          264|        then makeOverridable f allArgs
             |             ^
          265|        # This needs to be an abort so it can't be caught with `builtins.tryEval`,

       … while evaluating a branch condition
         at /nix/store/7fzm97kg6m5nh0623wx1b5h45n6g05g0-source/lib/customisation.nix:148:7:
          147|     in
          148|       if isAttrs result then
             |       ^
          149|         result // {

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: attribute 'stdenv' missing
       at /nix/store/7fzm97kg6m5nh0623wx1b5h45n6g05g0-source/pkgs/applications/networking/browsers/firefox/common.nix:177:28:
          176|   # LTO requires LLVM bintools including ld.lld and llvm-ar.
          177|   buildStdenv = overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override {
             |                            ^
          178|     bintools = if ltoSupport then buildPackages.rustc.llvmPackages.bintools else stdenv.cc.bintools;

$ nix eval github:NixOS/nixpkgs/pull/330754/merge#pkgsLLVM.betterbird-unwrapped
error:
       … while calling a functor (an attribute set with a '__functor' attribute)
         at /nix/store/7fzm97kg6m5nh0623wx1b5h45n6g05g0-source/lib/customisation.nix:264:13:
          263|     in if missingArgs == {}
          264|        then makeOverridable f allArgs
             |             ^
          265|        # This needs to be an abort so it can't be caught with `builtins.tryEval`,

       … while evaluating a branch condition
         at /nix/store/7fzm97kg6m5nh0623wx1b5h45n6g05g0-source/lib/customisation.nix:148:7:
          147|     in
          148|       if isAttrs result then
             |       ^
          149|         result // {

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: attribute 'stdenv' missing
       at /nix/store/7fzm97kg6m5nh0623wx1b5h45n6g05g0-source/pkgs/applications/networking/browsers/firefox/common.nix:177:28:
          176|   # LTO requires LLVM bintools including ld.lld and llvm-ar.
          177|   buildStdenv = overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override {
             |                            ^
          178|     bintools = if ltoSupport then buildPackages.rustc.llvmPackages.bintools else stdenv.cc.bintools;

Moving formatting changes to a separate commit might get it a bit easier to review what the PR changes WRT evaluation.

@RossComputerGuy
Copy link
Member Author

How did you test the eval?

nix repl. I just looked at my repl history and it seemed I wrongfully assumed the fix worked fully because I am used to the Nixpkgs LLVM WS flake automatically using pkgsLLVM with legacyPackages. I can finish up this fix easily.

@RossComputerGuy RossComputerGuy force-pushed the fix/pkgsllvm/rustc-eval branch from 3887dab to 7cb636d Compare July 29, 2024 05:53
@RossComputerGuy
Copy link
Member Author

Ok, it works now.

@trofi
Copy link
Contributor

trofi commented Jul 29, 2024

The pkgsLLVM.betterbird-unwrapped eval succeeds now. Thank you!

@RossComputerGuy
Copy link
Member Author

Only the manual rebuilds on x86_64-linux for some reason but it looks like this is ready and we probably should get it in before #332153, I'll merge if there's no objections.

@tomberek tomberek merged commit f13e283 into NixOS:staging Aug 4, 2024
27 checks passed
@RossComputerGuy RossComputerGuy deleted the fix/pkgsllvm/rustc-eval branch August 4, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants