From 3f3e74bc93d4d2ccbff8c5cfa913daf7f1baec3f Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Thu, 28 Dec 2023 15:28:09 +0000 Subject: stdenv: fix eval of pkgsMusl packages with platform constraints Before the change `pkgsMusl.adobe-reader` was failing the interpreter: $ nix-instantiate --eval --strict --expr 'with import ./. {}; builtins.tryEval pkgsMusl.adobe-reader' error: error: evaluation aborted with the following error message: 'unsupported platform for the pure Linux stdenv' After the change `pkgsMusl.adobe-reader` returns catchable excation: $ nix-instantiate --eval --strict --expr 'with import ./. {}; builtins.tryEval pkgsMusl.adobe-reader' { success = false; value = false; } Noticed when was exploring `nixpkgs` for uncatchable evaluation errors. Ideally those should only happen when there is a code bug in the use site. In this case it's just a package with incompatible constraints for `musl`. Changed uncatchable `abort` to `throw`. --- pkgs/stdenv/linux/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 35cdb6311df32..d2f3cc31ca08a 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -89,9 +89,9 @@ else null) null (lib.attrNames archLookupTable); archLookupTable = table.${localSystem.libc} - or (abort "unsupported libc for the pure Linux stdenv"); + or (throw "unsupported libc for the pure Linux stdenv"); files = archLookupTable.${localSystem.system} or (if getCompatibleTools != null then getCompatibleTools - else (abort "unsupported platform for the pure Linux stdenv")); + else (throw "unsupported platform for the pure Linux stdenv")); in files }: -- cgit 1.4.1