joypixels: Move assert to allow override

By moving the assert concerning license acceptance into the src
attribute license acceptance can be expressed with an override,
`joypixels.override { acceptLicense = true; }`.
This commit is contained in:
toonn 2020-08-16 21:02:02 +02:00 committed by Jan Tojnar
parent ca61c67381
commit fd653b992a
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4

@ -34,9 +34,7 @@ let inherit (stdenv.hostPlatform.parsed) kernel;
free = false;
};
in
assert !acceptLicense -> throw ''
throwLicense = throw ''
Use of the JoyPixels font requires acceptance of the license.
- ${joypixels-free-license.fullName} [1]
- ${joypixels-license-appendix.fullName} [2]
@ -55,13 +53,16 @@ assert !acceptLicense -> throw ''
[1]: ${joypixels-free-license.url}
[2]: ${joypixels-license-appendix.url}
'';
'';
in
stdenv.mkDerivation rec {
pname = "joypixels";
version = "6.0.0";
src = with systemSpecific; fetchurl {
src = assert !acceptLicense -> throwLicense;
with systemSpecific; fetchurl {
inherit name;
url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}";
sha256 = {
@ -85,7 +86,7 @@ stdenv.mkDerivation rec {
homepage = "https://www.joypixels.com/fonts";
license = let free-license = joypixels-free-license;
appendix = joypixels-license-appendix;
in {
in with systemSpecific; {
spdxId = "LicenseRef-JoyPixels-Free-6.0-with-${capitalized}-Appendix";
fullName = "${free-license.fullName} with ${appendix.fullName}";
url = free-license.url;