nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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-6.0";
24 fullName = "JoyPixels Free License Agreement 6.0";
25 url = "https://cdn.joypixels.com/distributions/${systemTag}/license/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.allowUnfree = true;
47 nixpkgs.config.joypixels.acceptLicense = true;
48
49 config.nix:
50 allowUnfree = true;
51 joypixels.acceptLicense = true;
52
53 [1]: ${joypixels-free-license.url}
54 [2]: ${joypixels-license-appendix.url}
55 '';
56
57in
58
59stdenv.mkDerivation rec {
60 pname = "joypixels";
61 version = "6.6.0";
62
63 src = assert !acceptLicense -> throwLicense;
64 with systemSpecific; fetchurl {
65 name = fontFile;
66 url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}";
67 sha256 = {
68 darwin = "0qcmb2vn2nykyikzgnlma627zhks7ksy1vkgvpcmqwyxq4bd38d7";
69 }.${kernel.name} or "17gjaz7353zyprmds64p01qivy2r8pwf88nvvhi57idas2qd604n";
70 };
71
72 dontUnpack = true;
73
74 installPhase = with systemSpecific; ''
75 runHook preInstall
76
77 install -Dm644 $src $out/share/fonts/truetype/${fontFile}
78
79 runHook postInstall
80 '';
81
82 meta = with lib; {
83 description = "The finest emoji you can use legally (formerly EmojiOne)";
84 longDescription = ''
85 Updated for 2021! JoyPixels 6.6 includes 3,559 originally crafted icon
86 designs and is 100% Unicode 13.1 compatible. We offer the largest
87 selection of files ranging from png, svg, iconjar, sprites, and fonts.
88 '';
89 homepage = "https://www.joypixels.com/fonts";
90 license =
91 let
92 free-license = joypixels-free-license;
93 appendix = joypixels-license-appendix;
94 in with systemSpecific; {
95 spdxId = "LicenseRef-JoyPixels-Free-6.0-with-${capitalized}-Appendix";
96 fullName = "${free-license.fullName} with ${appendix.fullName}";
97 url = free-license.url;
98 appendixUrl = appendix.url;
99 free = false;
100 };
101 maintainers = with maintainers; [ toonn jtojnar ];
102 };
103}