1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00
nixpkgs/lib/systems
Adam Joseph d278fd78af 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
2023-07-04 13:39:19 -07:00
..
architectures.nix lib.systems.architectures: add microarchitecture levels 2023-06-24 00:50:40 -06:00
default.nix lib.systems.extensions.sharedLibrary: do not throw 2023-07-04 13:39:19 -07:00
doubles.nix lib.platforms.mips{,64}-embedded: init 2023-06-30 18:19:00 -07:00
examples.nix lib.systems.bluefield2: init 2023-07-14 11:19:11 +02:00
flake-systems.nix lib: fix typos 2022-12-17 18:59:29 -05:00
inspect.nix lib.systems: add gnuabin32 to isGnu 2023-06-29 12:26:12 -07:00
parse.nix lib.systems: remove mipsisa(32|64)r6 triples 2023-06-01 10:42:27 +00:00
platforms.nix lib.systems.bluefield2: init 2023-07-14 11:19:11 +02:00