Files
Aliaksandr f8b9b7a087 stdenv/darwin: move the libiconv alias assertion into tests.stdenv
The final stage asserted

    assert prevStage.libiconv == prevStage.darwin.libiconv;

On Darwin `libiconv` is `darwin.libiconv`, so this compares a value with
itself. Nix does not notice: `eqValues` short-circuits only on pointer
identity of the two value slots, and these are two slots that resolve to
one attribute set. It therefore falls through to the derivation case,
which compares `outPath`.

`lib.extendDerivation` guards `outPath` behind the derivation's validity,
which reads `config.allowUnfree`, so the assertion demanded a `config`
option while the package set was still being assembled. When `config` is a
function it is passed `pkgs`, and the loop closes:

    (import <nixpkgs> {
      system = "aarch64-darwin";
      config = { pkgs, lib, ... }: { allowUnfree = lib.isAttrs pkgs; };
    }).config.allowUnfree

failed with an infinite recursion on Darwin while evaluating on Linux,
whose stdenv never forces a derivation that early. It now evaluates on
both.

Keep checking the invariant, from `tests.stdenv` instead. By then the
package set is complete, so forcing `outPath` is just a read.
The other twelve assertions in the stage read `passthru` and
`stdenv.cc.cc`, which are ungated, and stay where they are.

Assisted-by: claude-code with claude-opus-5[1m]-high
2026-08-10 00:50:54 +03:00
..