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

eval: add NIX_VALIDATE_EVAL_NONDETERMINISM know for attrset comparison #8711

Closed
wants to merge 1 commit into from
Closed

eval: add NIX_VALIDATE_EVAL_NONDETERMINISM know for attrset comparison #8711

wants to merge 1 commit into from

Commits on Jul 17, 2023

  1. eval: add NIX_VALIDATE_EVAL_NONDETERMINISM know for attrset comparison

    This change adds an extra knob to detect nin-determinism in attrset
    comparison. It follows real problem discovered by Vladimir Kryachko
    in current `nixpkgs` that fails evaluation non-deterministically based
    on internal state of the eval:
    
    This works:
    
        $ nix-instantiate -E 'let pkgs = import <nixpkgs> {}; in pkgs.nix'
        /nix/store/6gzxax0rl0k1n3hg0s22jnj6c1c0aj3b-nix-2.15.1.drv
    
    This fails:
    
        $ nix-instantiate -E 'let pkgs = import <nixpkgs> {}; in let aaaaaaaaaaa = { bbbbbbbbbbbbbb.extensions = []; }; in pkgs.nix'
        error: assertion '(final).hasSharedLibraries' failed
    
    Note that `let aaaaaaaaaaa = { ... }` binding should not be able to
    affect evaluation of `pkgs.nix`.
    
    This happens because attrsets are implementing lazy attrset comparison.
    The change implements eager comparison when `NIX_VALIDATE_EVAL_NONDETERMINISM`
    is set to ease debugging such failures.
    trofi committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    9ac604c View commit details
    Browse the repository at this point in the history