Skip to content

firefox: relax disallowedRequisites to disallowedReferences to fix cuda build#457391

Closed
GaetanLepage wants to merge 1 commit intoNixOS:masterfrom
GaetanLepage:firefox-reference
Closed

firefox: relax disallowedRequisites to disallowedReferences to fix cuda build#457391
GaetanLepage wants to merge 1 commit intoNixOS:masterfrom
GaetanLepage:firefox-reference

Conversation

@GaetanLepage
Copy link
Contributor

@GaetanLepage GaetanLepage commented Oct 31, 2025

When cudaSupport is enabled, cudaPackages.cuda_nvcc becomes a transitive dependency of firefox.
cuda_nvcc has backendStdenv.cc in its propagatedBuildInputs which violates firefox's disallowedRequisites policy.
This breaks firefox when cudaSupport is enabled:

firefox> building '/nix/store/7s1dyndj7r33wck6dywjf6kqxah7ngm2-firefox-144.0.2.drv'
firefox> structuredAttrs is enabled
error: output '/nix/store/b3cyrj28jf03mrf15jmy9whhfrgy2bxw-firefox-144.0.2' is not allowed to refer to the following paths:
         /nix/store/x8mydcgbry214s802nzvy7fdljx404ym-gcc-wrapper-14.3.0

I propose to relax the disallowedRequisites assertion and simply migrate to disallowedReferences which ensures that stdenv.cc is not a direct dependency of firefox.

NOTE: this only became an issue recently (since #437723) because before, cudaPackages.backendStdenv and stdenv were differing.
Now they are the same, which triggers this error.

cc @mweinelt @booxter
cc @ConnorBaker @SomeoneSerge

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

…da build

When cudaSupport is enabled, cudaPackages.cuda_nvcc becomes a transitive
dependency of firefox.
It adds backendStdenv.cc to its propagatedBuildInputs which violates
firefox's disallowedRequisites policy.
This breaks firefox when cudaSupport is enabled.

I propose to relax the disallowedRequisites assertion and simply migrate
to disallowedReferences which ensures that stdenv.cc is not a direct
dependency of firefox.
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Oct 31, 2025
@booxter
Copy link
Contributor

booxter commented Nov 1, 2025

Hm. Why are these references in the output though? Do you have a list of matches that break the expectation? I'd not expect gcc-wrapper to be in the final output.

@SomeoneSerge SomeoneSerge linked an issue Nov 1, 2025 that may be closed by this pull request
3 tasks
@Janrupf
Copy link
Contributor

Janrupf commented Nov 1, 2025

If I understand correctly this happens because cuda_nvcc has the stdenv in its propagated build inputs:

# Entries here will be in nativeBuildInputs when cuda_nvcc is in nativeBuildInputs
propagatedBuildInputs = [ backendStdenv.cc ];

But I don't know how this propagates through onnxruntime

@SomeoneSerge
Copy link
Contributor

My preliminary assessment is that we need to revert nvcc's propagatedBuildInputs back to

propagatedBuildInputs = prevAttrs.propagatedBuildInputs or [ ] ++ [ setupCudaHook ];
, but uhh "preliminary"

@Janrupf
Copy link
Contributor

Janrupf commented Nov 1, 2025

Not sure if I misunderstand something - but onnxruntime shouldn't depend on nvcc at runtime, should it? As far as I understand cuda_nvcc depending on gcc at runtime is fine, but onnxruntime depending on nvcc at runtime is not, its in nativeBuildInputs there afterall

@SomeoneSerge
Copy link
Contributor

@Janrupf I didn't read the onnxruntime part yet, will follow up

@SomeoneSerge
Copy link
Contributor

Actually, even now I feel fairly confident that relaxing disallowedRequisites would be the wrong thing to do here

@Janrupf
Copy link
Contributor

Janrupf commented Nov 1, 2025

I agree, this is an actual issue and not in firefox either. What I'm trying to say is that while firefox reveals the issue and it may have been detected due to a change in the cuda package set, the real issue (again, if I understand correctly) is onnxruntime depending on nvcc at runtime.

EDIT: It seems like the hashes for the nvcc package end up in libonnxruntime_providers_cuda.so in onnxruntime (strings and then grep for the nvcc derivation hash), which in return probably results in nix adding nvcc as a runtime dependency.

@winterqt
Copy link
Member

winterqt commented Nov 1, 2025

Closing as I think we’re all in agreement that this isn’t the right move.

@winterqt winterqt closed this Nov 1, 2025
@GaetanLepage
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 457391 --extra-nixpkgs-config '{ allowUnfree = true; cudaSupport = true; }'
Commit: cd7510e4de167e9f788b41b378bcf5f131ba7cc4


x86_64-linux

✅ 21 packages built:
  • dropbox
  • dropbox-cli
  • dropbox-cli.nautilusExtension
  • eyewitness
  • firefox
  • firefox-beta
  • firefox-bin
  • firefox-devedition
  • firefox-esr
  • firefox-mobile
  • floorp-bin
  • librewolf
  • librewolf-bin
  • mate.caja-dropbox
  • nixpkgs-manual
  • sitespeed-io
  • thunderbird (thunderbird-latest)
  • thunderbird-140 (thunderbird-esr)
  • thunderbird-bin
  • thunderbird-esr-bin
  • vimb

@GaetanLepage GaetanLepage deleted the firefox-reference branch November 1, 2025 09:56
@carlthome
Copy link
Member

As a regular NixOS 25.05 (soon 25.11) user who's just trying to get nixos-rebuild to work again with Firefox enabled on a gaming desktop, what's the suggested action to resolve this issue?

Found this PR by Googling.

@GaetanLepage
Copy link
Contributor Author

As a regular NixOS 25.05 (soon 25.11) user who's just trying to get nixos-rebuild to work again with Firefox enabled on a gaming desktop, what's the suggested action to resolve this issue?

Found this PR by Googling.

The easiest would be to switch to nixos-25.11, where the problem is fixed.
If you really have to remain on nixos-25.05, you can use:

programs.firefox = {
  package = pkgs.firefox.overrideAttrs { disallowedRequisites = [ ]; };
};

or if you don't use the programs.firefox module:

environment.systemPackages = [
  (pkgs.firefox.overrideAttrs { disallowedRequisites = [ ]; })
];

@SomeoneSerge
Copy link
Contributor

@carlthome please also do report your nixpkgs revision and the output of nix why-depends --precise $firefoxOutput $nvccOutput

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

9.needs: reviewer This PR currently has no reviewers requested and needs attention. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure when CUDA enabled: firefox

6 participants