summary refs log tree commit diff
path: root/pkgs/stdenv/generic/default.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-08-27 12:10:56 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-08-27 15:32:45 +0200
commitf15270833ad3e843619fc953e4b28e2d9499b3f2 (patch)
tree58394c582facea433efa919cd0ac8d26e4c3a7bf /pkgs/stdenv/generic/default.nix
parent6fe75323961b4e23fd5ce71b044700c9377cbfd0 (diff)
downloadnixpkgs-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar
nixpkgs-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.gz
nixpkgs-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.bz2
nixpkgs-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.lz
nixpkgs-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.xz
nixpkgs-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.zst
nixpkgs-f15270833ad3e843619fc953e4b28e2d9499b3f2.zip
Don't barf JSON at users in error messages
Diffstat (limited to 'pkgs/stdenv/generic/default.nix')
-rw-r--r--pkgs/stdenv/generic/default.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index fe7bec54ba0..249e4845bc2 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -27,7 +27,7 @@ let
     lib.lists.all (license:
       let l = lib.licenses.${license.shortName or "BROKEN"} or false; in
       if license == l then true else
-        throw ''‘${builtins.toJSON license}’ is not an attribute of lib.licenses''
+        throw ''‘${showLicense license}’ is not an attribute of lib.licenses''
     ) list;
 
   mutuallyExclusive = a: b:
@@ -73,6 +73,8 @@ let
     isUnfree (lib.lists.toList attrs.meta.license) &&
     !allowUnfreePredicate attrs;
 
+  showLicense = license: license.shortName or "unknown";
+
   defaultNativeBuildInputs = extraBuildInputs ++
     [ ../../build-support/setup-hooks/move-docs.sh
       ../../build-support/setup-hooks/compress-man-pages.sh
@@ -121,9 +123,9 @@ let
 
       licenseAllowed = attrs:
         if hasDeniedUnfreeLicense attrs && !(hasWhitelistedLicense attrs) then
-          throwEvalHelp "Unfree" "has an unfree license ‘${builtins.toJSON attrs.meta.license}’ which is not whitelisted"
+          throwEvalHelp "Unfree" "has an unfree license (‘${showLicense attrs.meta.license}’)"
         else if hasBlacklistedLicense attrs then
-          throwEvalHelp "blacklisted" "has the ‘${builtins.toJSON attrs.meta.license}’ license which is blacklisted"
+          throwEvalHelp "blacklisted" "has a blacklisted license (‘${showLicense attrs.meta.license}’)"
         else if !allowBroken && attrs.meta.broken or false then
           throwEvalHelp "Broken" "is marked as broken"
         else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem result.system attrs.meta.platforms then