Skip to content

Show the references of a failing build when disallowedReferences are referenced #11201

Description

@doronbehar

Is your feature request related to a problem? Please describe.

Sometimes when I update or change some detail in a package with multiple outputs or with explicitly set disallowedReferences, the references I disallow reappear all of a sudden. It is very frustrating how a build that takes a few minutes fails for this small reason in the very end, and I can't know exactly why.

Describe the solution you'd like

Here's the build failure message I'd like to see:

build failed due to disallowed reference "/nix/store/..." retained in output "bin":
/nix/store/qdrb3l3858yywwvqyq3r67jivklc15nl-${pname}-${version}-bin
└───bin/xtrace: …e.so'.pcprofiledump='/nix/store/qdrb3l3858yywwvqyq3r67jivklc15nl-glibc-2.39-52-bin/bin/pcprofile…
    → /nix/store/qdrb3l3858yywwvqyq3r67jivklc15nl-glibc-2.39-52-bin

(The above output was generated with nix why-depends --all --precise nixpkgs#glibc nixpkgs#glibc (from the docs example).)

Describe alternatives you've considered

In cases the disallowedReferences are explicitly set to external derivations (such as stdenv.cc), this following is possible:

  • Running the build with the disallowedReferences unset
  • See the references and try to fix them
  • Run the build again with the disallowedReferences set.

But for the perhaps slightly more common case of multiple outputs referencing each other and thus causing cyclic references issues. I can't find a way to debug such a build failure even when I don't mind running builds more then once.

Additional context

It was extremely hard and frustrating to fix the cyclic references in the openmpi 5.0 update, between "out" and "dev" - there the build took ~15 minutes and it failed every time only at the very end due to this.

Priorities

Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature request or proposal

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions