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

lib.systems.extensions.sharedLibrary: do not throw #244118

Merged
1 commit merged into from Jul 20, 2023
Merged

lib.systems.extensions.sharedLibrary: do not throw #244118

1 commit merged into from Jul 20, 2023

Commits on Jul 4, 2023

  1. lib.systems.extensions.sharedLibrary: do not throw

    Because downstream code expects to use `==` on platform attrsets, we
    are unfortunately not able to throw a useful error message when the
    `sharedLibrary` attribute is accessed.
    
    When users do a comparison like:
    
      stdenv.hostPlatform == pkgsStatic.stdenv.hostPlatform
    
    ... in a situation where `stdenv.hostPlatform.hasSharedLibraries`,
    they expect this to return `false`.  Unfortunately Nix does a deep
    equality comparison here, and ends up forcing the
    `pkgsStatic.stdenv.hostPlatform.extensions.sharedLibrary` attribute,
    which throws the error.
    
    Rather than returning `null`, this commit instead simply omits the
    `extensions.sharedLibrary` attribute.  This provides the user with a
    more-useful error message: instead of waiting until the `null` is
    used (and hoping that produces an error), the user will get an error
    about the `extensions.sharedLibrary` attribute being missing, at the
    position where it was referenced.
    
    Big thanks to @trofi for his PR to add
    `NIX_VALIDATE_EVAL_NONDETERMINISM` to Nix, which I am now using.  It
    made tracking this down really easy!
    
    Fixes #244045
    Adam Joseph committed Jul 4, 2023
    Configuration menu
    Copy the full SHA
    d278fd7 View commit details
    Browse the repository at this point in the history