Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 113 lines 3.5 kB view raw
1{ lib, stdenv 2, fetchurl 3, config 4, acceptLicense ? config.joypixels.acceptLicense or false 5}: 6 7let 8 inherit (stdenv.hostPlatform.parsed) kernel; 9 10 systemSpecific = { 11 darwin = rec { 12 systemTag = "nix-darwin"; 13 capitalized = systemTag; 14 fontFile = "JoyPixels-SBIX.ttf"; 15 }; 16 }.${kernel.name} or rec { 17 systemTag = "nixos"; 18 capitalized = "NixOS"; 19 fontFile = "joypixels-android.ttf"; 20 }; 21 22 joypixels-free-license = with systemSpecific; { 23 spdxId = "LicenseRef-JoyPixels-Free"; 24 fullName = "JoyPixels Free License Agreement"; 25 url = "https://cdn.joypixels.com/free-license.pdf"; 26 free = false; 27 }; 28 29 joypixels-license-appendix = with systemSpecific; { 30 spdxId = "LicenseRef-JoyPixels-NixOS-Appendix"; 31 fullName = "JoyPixels ${capitalized} License Appendix"; 32 url = "https://cdn.joypixels.com/distributions/${systemTag}/appendix/joypixels-license-appendix.pdf"; 33 free = false; 34 }; 35 36 throwLicense = throw '' 37 Use of the JoyPixels font requires acceptance of the license. 38 - ${joypixels-free-license.fullName} [1] 39 - ${joypixels-license-appendix.fullName} [2] 40 41 You can express acceptance by setting acceptLicense to true in your 42 configuration. Note that this is not a free license so it requires allowing 43 unfree licenses. 44 45 configuration.nix: 46 nixpkgs.config.allowUnfreePredicate = pkg: 47 builtins.elem (lib.getName pkg) [ 48 "joypixels" 49 ]; 50 nixpkgs.config.joypixels.acceptLicense = true; 51 52 config.nix: 53 allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ 54 "joypixels" 55 ]; 56 joypixels.acceptLicense = true; 57 58 [1]: ${joypixels-free-license.url} 59 [2]: ${joypixels-license-appendix.url} 60 ''; 61 62in 63 64stdenv.mkDerivation rec { 65 pname = "joypixels"; 66 version = "8.0.0"; 67 68 src = assert !acceptLicense -> throwLicense; 69 with systemSpecific; fetchurl { 70 name = fontFile; 71 url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}"; 72 sha256 = { 73 darwin = "0kj4nck6k91avhan9iy3n8hhk47xr44rd1lzljjx3w2yzw1w9zvv"; 74 }.${kernel.name} or "1bkyclgmvl6ppbdvidc5xr1g6f215slf0glnh5p6fsfbxc5h95bw"; 75 }; 76 77 dontUnpack = true; 78 79 installPhase = with systemSpecific; '' 80 runHook preInstall 81 82 install -Dm644 $src $out/share/fonts/truetype/${fontFile} 83 84 runHook postInstall 85 ''; 86 87 meta = with lib; { 88 description = "Finest emoji you can use legally (formerly EmojiOne)"; 89 longDescription = '' 90 Updated for 2023! JoyPixels 8.0 includes 3,702 originally crafted icon 91 designs and is 100% Unicode 15.0 compatible. We offer the largest 92 selection of files ranging from png, svg, iconjar, and fonts (sprites 93 available upon request). 94 ''; 95 homepage = "https://www.joypixels.com/fonts"; 96 hydraPlatforms = []; # Just a binary file download, nothing to cache. 97 license = 98 let 99 free-license = joypixels-free-license; 100 appendix = joypixels-license-appendix; 101 in with systemSpecific; { 102 spdxId = "LicenseRef-JoyPixels-Free-with-${capitalized}-Appendix"; 103 fullName = "${free-license.fullName} with ${appendix.fullName}"; 104 url = free-license.url; 105 appendixUrl = appendix.url; 106 free = false; 107 }; 108 maintainers = with maintainers; [ toonn jtojnar ]; 109 # Not quite accurate since it's a font, not a program, but clearly 110 # indicates we're not actually building it from source. 111 sourceProvenance = [ sourceTypes.binaryNativeCode ]; 112 }; 113}