Files
lix/doc/manual/rl-next/nix-develop-output-checks.md
T
Raito Bezarius 992c3ae981 nix3/develop: support structured attrs-based output checks
nix develop should ignore output checks in general.

This was done only for the old way of specifying output checks, the
structured attrs way requires rewriting the JSON and removing the output
checks pieces.

We take a brutal approach of removing as many as possible including
non-recommended ways of doing it.

Fixes #997.

Change-Id: Iaf83029016c71b5171e56e15d4eadc1a60a8be98
Signed-off-by: Raito Bezarius <raito@lix.systems>
2025-09-23 14:35:08 +00:00

1.2 KiB

synopsis, issues, cls, category, credits
synopsis issues cls category credits
Fix nix develop for derivations that rejects dependencies with structured attrs
fj#997
4182
Fixes
raito

For the sake of concision, we refer to disallowedReferences in what follows, but all output checks were equally fixed: {dis,}allowed{References,Requisites}.

Derivations can define output checks to reject unwanted dependencies, such as interpreters like bash or compilers like gcc. This can be done in two ways:

  • Legacy style: disallowedReferences = [ ... ] in the environment.
  • Structured attrs: outputChecks.<output>.disallowedReferences = [ ... ], typically used in __json.

Only the structured form supports derivations with multiple outputs.

nix develop internally rewrites derivations to create development shells. It relied on the legacy disallowedReferences, and failed to honor the structured variant. This led to broken shells in cases where bashInteractive was explicitly disallowed using structured output checks, e.g. nix develop nixpkgs#systemd after the "bash-less NixOS" changes.

This fix teaches nix develop to respect structured output checks, restoring support for such derivations.