From da117df3f4ec0e76cfa2ef35717a71bd41726467 Mon Sep 17 00:00:00 2001 From: toonn Date: Thu, 6 Aug 2020 12:37:25 +0200 Subject: [PATCH 01/15] joypixels: Use dedicated NixOS cdn endpoint The Arch Linux endpoint was not intended to be used as-is by other distros. I have asked for and received a proper license with a dedicated endpoint for NixOS. --- pkgs/data/fonts/joypixels/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index 1b107f9cb82..efc2d70d1c8 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -5,7 +5,7 @@ stdenv.mkDerivation rec { version = "6.0.0"; src = fetchurl { - url = "https://cdn.joypixels.com/arch-linux/font/${version}/joypixels-android.ttf"; + url = "https://cdn.joypixels.com/distributions/nix-os/font/${version}/joypixels-android.ttf"; sha256 = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; }; @@ -19,6 +19,6 @@ stdenv.mkDerivation rec { description = "Emoji as a Service (formerly EmojiOne)"; homepage = "https://www.joypixels.com/"; license = licenses.unfree; - maintainers = with maintainers; [ jtojnar ]; + maintainers = with maintainers; [ toonn jtojnar ]; }; } From e0ad840a06029a49ee8d3b8b1f871efa78c9e905 Mon Sep 17 00:00:00 2001 From: toonn Date: Thu, 6 Aug 2020 13:17:41 +0200 Subject: [PATCH 02/15] joypixels: Add support for darwin --- pkgs/data/fonts/joypixels/default.nix | 37 +++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index efc2d70d1c8..3806da6c9f3 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -1,24 +1,51 @@ { stdenv, fetchurl }: stdenv.mkDerivation rec { + inherit (stdenv.hostPlatform) system; + + throwSystem = throw "Unsupported system: ${system}"; + pname = "joypixels"; version = "6.0.0"; + url = { + x86_64-darwin = "https://cdn.joypixels.com/distributions/nix-darwin/font/6.0.0/Apple%20Color%20Emoji.ttc"; + x86_64-linux = "https://cdn.joypixels.com/distributions/nix-os/font/${version}/joypixels-android.ttf"; + }.${system} or throwSystem; + + name = { + x86_64-darwin = "joypixels-apple-color-emoji.ttc"; + x86_64-linux = "joypixels-android.ttf"; + }.${system} or throwSystem; + + sha256 = { + x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; + x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; + }.${system} or throwSystem; + src = fetchurl { - url = "https://cdn.joypixels.com/distributions/nix-os/font/${version}/joypixels-android.ttf"; - sha256 = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; + inherit url name sha256; }; dontUnpack = true; - installPhase = '' - install -Dm644 $src $out/share/fonts/truetype/joypixels.ttf - ''; + installPhase = { + x86_64-darwin = '' + install -Dm644 $src $out/share/fonts/truetype/joypixels.ttc + ''; + x86_64-linux = '' + install -Dm644 $src $out/share/fonts/truetype/joypixels.ttf + ''; + }.${system} or throwSystem; meta = with stdenv.lib; { description = "Emoji as a Service (formerly EmojiOne)"; homepage = "https://www.joypixels.com/"; license = licenses.unfree; maintainers = with maintainers; [ toonn jtojnar ]; + platforms = [ + "x86_64-darwin" + "x86_64-linux" + ]; }; } From 568beeaa28ce79d399d5ccc7511c019a1731d38c Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 7 Aug 2020 21:52:38 +0200 Subject: [PATCH 03/15] joypixels: Refactor src and installPhase for clarity --- pkgs/data/fonts/joypixels/default.nix | 69 ++++++++++++++++----------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index 3806da6c9f3..fabffe88d91 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -1,42 +1,55 @@ { stdenv, fetchurl }: +let inherit (stdenv.hostPlatform) system; + + throwSystem = throw "Unsupported system: ${system}"; + + systemTag = { + x86_64-darwin = "nix-darwin"; + x86_64-linux = "nix-os"; + }.${system} or throwSystem; + + capitalized = { + x86_64-darwin = systemTag; + x86_64-linux = "NixOS"; + }.${system} or throwSystem; + + fontFile = { + x86_64-darwin = "Apple%20Color%20Emoji.ttc"; + x86_64-linux = "joypixels-android.ttf"; + }.${system} or throwSystem; + + name = { + x86_64-darwin = "joypixels-apple-color-emoji.ttc"; + x86_64-linux = fontFile; + }.${system} or throwSystem; + + ext = { + x86_64-darwin = "ttc"; + x86_64-linux = "ttf"; + }.${system} or throwSystem; + + sha256 = { + x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; + x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; + }.${system} or throwSystem; + +in + stdenv.mkDerivation rec { - inherit (stdenv.hostPlatform) system; - - throwSystem = throw "Unsupported system: ${system}"; - pname = "joypixels"; version = "6.0.0"; - url = { - x86_64-darwin = "https://cdn.joypixels.com/distributions/nix-darwin/font/6.0.0/Apple%20Color%20Emoji.ttc"; - x86_64-linux = "https://cdn.joypixels.com/distributions/nix-os/font/${version}/joypixels-android.ttf"; - }.${system} or throwSystem; - - name = { - x86_64-darwin = "joypixels-apple-color-emoji.ttc"; - x86_64-linux = "joypixels-android.ttf"; - }.${system} or throwSystem; - - sha256 = { - x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; - x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; - }.${system} or throwSystem; - src = fetchurl { - inherit url name sha256; + inherit name sha256; + url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}"; }; dontUnpack = true; - installPhase = { - x86_64-darwin = '' - install -Dm644 $src $out/share/fonts/truetype/joypixels.ttc - ''; - x86_64-linux = '' - install -Dm644 $src $out/share/fonts/truetype/joypixels.ttf - ''; - }.${system} or throwSystem; + installPhase = '' + install -Dm644 $src $out/share/fonts/truetype/joypixels.${ext} + ''; meta = with stdenv.lib; { description = "Emoji as a Service (formerly EmojiOne)"; From d36a92fd2c80f4a3a3368eb1d9ca2619e80fdd4e Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 7 Aug 2020 21:54:33 +0200 Subject: [PATCH 04/15] joypixels: Update metadata --- pkgs/data/fonts/joypixels/default.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index fabffe88d91..561ea4abce2 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -52,13 +52,14 @@ stdenv.mkDerivation rec { ''; meta = with stdenv.lib; { - description = "Emoji as a Service (formerly EmojiOne)"; - homepage = "https://www.joypixels.com/"; + description = "The finest emoji you can use legally (formerly EmojiOne)"; + longDescription = '' + New for 2020! JoyPixels 6.0 includes 3,342 originally crafted icon + designs and is 100% Unicode 13 compatible. We offer the largest selection + of files ranging from png, svg, iconjar, sprites, and fonts. + ''; + homepage = "https://www.joypixels.com/fonts"; license = licenses.unfree; maintainers = with maintainers; [ toonn jtojnar ]; - platforms = [ - "x86_64-darwin" - "x86_64-linux" - ]; }; } From cd255a375e4e0ed2aee9ca964f0e52d37b12c872 Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 7 Aug 2020 21:55:15 +0200 Subject: [PATCH 05/15] joypixels: Add proper license The JoyPixels font comes with a license which requires explicit acceptance by the user. --- pkgs/data/fonts/joypixels/default.nix | 34 +++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index 561ea4abce2..3385209880f 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, acceptLicense ? false }: let inherit (stdenv.hostPlatform) system; @@ -29,6 +29,17 @@ let inherit (stdenv.hostPlatform) system; x86_64-linux = "ttf"; }.${system} or throwSystem; + joypixels-free-license = { + spdxId = "LicenseRef-JoyPixels-Free-6.0"; + fullName = "JoyPixels Free License Agreement 6.0"; + url = "https://cdn.joypixels.com/distributions/${systemTag}/license/free-license.pdf"; + }; + joypixels-license-appendix = { + spdxId = "LicenseRef-JoyPixels-NixOS-Appendix"; + fullName = "JoyPixels ${capitalized} License Appendix"; + url = "https://cdn.joypixels.com/distributions/${systemTag}/appendix/joypixels-license-appendix.pdf"; + }; + sha256 = { x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; @@ -36,6 +47,18 @@ let inherit (stdenv.hostPlatform) system; in +assert !acceptLicense -> throw '' + Use of the JoyPixels font requires acceptance of the license. + - ${joypixels-free-license.fullName} [1] + - ${joypixels-license-appendix.fullName} [2] + + You can express acceptance by overriding acceptLicense: + (joypixels.override { acceptLicense = true; }) + + [1]: ${joypixels-free-license.url} + [2]: ${joypixels-license-appendix.url} +''; + stdenv.mkDerivation rec { pname = "joypixels"; version = "6.0.0"; @@ -59,7 +82,14 @@ stdenv.mkDerivation rec { of files ranging from png, svg, iconjar, sprites, and fonts. ''; homepage = "https://www.joypixels.com/fonts"; - license = licenses.unfree; + license = let free-license = joypixels-free-license; + appendix = joypixels-license-appendix; + in { + spdxId = "LicenseRef-JoyPixels-Free-6.0-with-${capitalized}-Appendix"; + fullName = "${free-license.fullName} with ${appendix.fullName}"; + url = free-license.url; + appendixUrl = appendix.url; + }; maintainers = with maintainers; [ toonn jtojnar ]; }; } From a880ab2e98d935ab2b77c4c0ca82b3fd8358a988 Mon Sep 17 00:00:00 2001 From: toonn Date: Sat, 8 Aug 2020 21:00:04 +0200 Subject: [PATCH 06/15] joypixels: Refactor to group system-specific variables --- pkgs/data/fonts/joypixels/default.nix | 58 ++++++++++++--------------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index 3385209880f..eb9bc5cf910 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -4,47 +4,35 @@ let inherit (stdenv.hostPlatform) system; throwSystem = throw "Unsupported system: ${system}"; - systemTag = { - x86_64-darwin = "nix-darwin"; - x86_64-linux = "nix-os"; + systemSpecific = { + x86_64-darwin = rec { + systemTag = "nix-darwin"; + capitalized = systemTag; + ext = "ttc"; + fontFile = "Apple%20Color%20Emoji.ttc"; + name = "joypixels-apple-color-emoji.ttc"; + }; + x86_64-linux = rec { + systemTag = "nix-os"; + capitalized = "NixOS"; + ext = "ttf"; + fontFile = "joypixels-android.ttf"; + name = fontFile; + }; }.${system} or throwSystem; - capitalized = { - x86_64-darwin = systemTag; - x86_64-linux = "NixOS"; - }.${system} or throwSystem; - - fontFile = { - x86_64-darwin = "Apple%20Color%20Emoji.ttc"; - x86_64-linux = "joypixels-android.ttf"; - }.${system} or throwSystem; - - name = { - x86_64-darwin = "joypixels-apple-color-emoji.ttc"; - x86_64-linux = fontFile; - }.${system} or throwSystem; - - ext = { - x86_64-darwin = "ttc"; - x86_64-linux = "ttf"; - }.${system} or throwSystem; - - joypixels-free-license = { + joypixels-free-license = with systemSpecific; { spdxId = "LicenseRef-JoyPixels-Free-6.0"; fullName = "JoyPixels Free License Agreement 6.0"; url = "https://cdn.joypixels.com/distributions/${systemTag}/license/free-license.pdf"; }; - joypixels-license-appendix = { + + joypixels-license-appendix = with systemSpecific; { spdxId = "LicenseRef-JoyPixels-NixOS-Appendix"; fullName = "JoyPixels ${capitalized} License Appendix"; url = "https://cdn.joypixels.com/distributions/${systemTag}/appendix/joypixels-license-appendix.pdf"; }; - sha256 = { - x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; - x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; - }.${system} or throwSystem; - in assert !acceptLicense -> throw '' @@ -63,14 +51,18 @@ stdenv.mkDerivation rec { pname = "joypixels"; version = "6.0.0"; - src = fetchurl { - inherit name sha256; + src = with systemSpecific; fetchurl { + inherit name; url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}"; + sha256 = { + x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; + x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; + }.${system} or throwSystem; }; dontUnpack = true; - installPhase = '' + installPhase = with systemSpecific; '' install -Dm644 $src $out/share/fonts/truetype/joypixels.${ext} ''; From 25ca62c2a2d9cadb0352882ef9cd8a1a1e79671e Mon Sep 17 00:00:00 2001 From: toonn Date: Sat, 8 Aug 2020 21:15:08 +0200 Subject: [PATCH 07/15] joypixels: Switch from override to config option Switch from an overridden variable to an option specified in configuration.nix or config.nix: ``` joypixels.acceptLicense = true; ``` --- pkgs/data/fonts/joypixels/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index eb9bc5cf910..2b39595f0e1 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl, acceptLicense ? false }: +{ stdenv, fetchurl, config +, acceptLicense ? config.joypixels.acceptLicense or false +}: let inherit (stdenv.hostPlatform) system; @@ -40,8 +42,9 @@ assert !acceptLicense -> throw '' - ${joypixels-free-license.fullName} [1] - ${joypixels-license-appendix.fullName} [2] - You can express acceptance by overriding acceptLicense: - (joypixels.override { acceptLicense = true; }) + You can express acceptance by setting acceptLicense to true in your + configuration (configuration.nix or config.nix): + joypixels.acceptLicense = true; [1]: ${joypixels-free-license.url} [2]: ${joypixels-license-appendix.url} From c5249d1e9da68cdaadb4dd98378e02a0bc7911c3 Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 9 Aug 2020 20:10:54 +0200 Subject: [PATCH 08/15] joypixels: Refactor to special-case darwin Specifying the system-specific variables for x86_64-darwin and x86_64-linux is too restrictive, excluding for example i686-linux. Since macOS seems to be the odd one out we can special-case only x86_64-darwin. --- pkgs/data/fonts/joypixels/default.nix | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index 2b39595f0e1..fba838bb65b 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -4,8 +4,6 @@ let inherit (stdenv.hostPlatform) system; - throwSystem = throw "Unsupported system: ${system}"; - systemSpecific = { x86_64-darwin = rec { systemTag = "nix-darwin"; @@ -14,14 +12,13 @@ let inherit (stdenv.hostPlatform) system; fontFile = "Apple%20Color%20Emoji.ttc"; name = "joypixels-apple-color-emoji.ttc"; }; - x86_64-linux = rec { + }.${system} or rec { systemTag = "nix-os"; capitalized = "NixOS"; ext = "ttf"; fontFile = "joypixels-android.ttf"; name = fontFile; }; - }.${system} or throwSystem; joypixels-free-license = with systemSpecific; { spdxId = "LicenseRef-JoyPixels-Free-6.0"; @@ -59,8 +56,7 @@ stdenv.mkDerivation rec { url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}"; sha256 = { x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; - x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; - }.${system} or throwSystem; + }.${system} or "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; }; dontUnpack = true; From f9f1cbbffa34e8486ec5df6d4413f68ec79388a3 Mon Sep 17 00:00:00 2001 From: toonn Date: Mon, 10 Aug 2020 10:39:26 +0200 Subject: [PATCH 09/15] joypixels: Switch on kernel.name rather than system x86_64-darwin is too specific because macOS runs on multiple architectures. --- pkgs/data/fonts/joypixels/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index fba838bb65b..f4df27c70aa 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -2,17 +2,17 @@ , acceptLicense ? config.joypixels.acceptLicense or false }: -let inherit (stdenv.hostPlatform) system; +let inherit (stdenv.hostPlatform.parsed) kernel; systemSpecific = { - x86_64-darwin = rec { + darwin = rec { systemTag = "nix-darwin"; capitalized = systemTag; ext = "ttc"; fontFile = "Apple%20Color%20Emoji.ttc"; name = "joypixels-apple-color-emoji.ttc"; }; - }.${system} or rec { + }.${kernel.name} or rec { systemTag = "nix-os"; capitalized = "NixOS"; ext = "ttf"; @@ -55,8 +55,8 @@ stdenv.mkDerivation rec { inherit name; url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}"; sha256 = { - x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; - }.${system} or "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; + darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; + }.${kernel.name} or "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; }; dontUnpack = true; From 48128ba77fe7a941c5c3b989435d373083a75061 Mon Sep 17 00:00:00 2001 From: toonn Date: Tue, 11 Aug 2020 19:49:06 +0200 Subject: [PATCH 10/15] joypixels: Mark license as unfree --- pkgs/data/fonts/joypixels/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index f4df27c70aa..c3261196254 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -24,12 +24,14 @@ let inherit (stdenv.hostPlatform.parsed) kernel; spdxId = "LicenseRef-JoyPixels-Free-6.0"; fullName = "JoyPixels Free License Agreement 6.0"; url = "https://cdn.joypixels.com/distributions/${systemTag}/license/free-license.pdf"; + free = false; }; joypixels-license-appendix = with systemSpecific; { spdxId = "LicenseRef-JoyPixels-NixOS-Appendix"; fullName = "JoyPixels ${capitalized} License Appendix"; url = "https://cdn.joypixels.com/distributions/${systemTag}/appendix/joypixels-license-appendix.pdf"; + free = false; }; in @@ -80,6 +82,7 @@ stdenv.mkDerivation rec { fullName = "${free-license.fullName} with ${appendix.fullName}"; url = free-license.url; appendixUrl = appendix.url; + free = false; }; maintainers = with maintainers; [ toonn jtojnar ]; }; From 0da946eac82c2373d75f1cadf1a18dd2b908d191 Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 14 Aug 2020 18:41:46 +0200 Subject: [PATCH 11/15] joypixels: Reword license acceptance warning --- pkgs/data/fonts/joypixels/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index c3261196254..ab05cee885d 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -42,7 +42,15 @@ assert !acceptLicense -> throw '' - ${joypixels-license-appendix.fullName} [2] You can express acceptance by setting acceptLicense to true in your - configuration (configuration.nix or config.nix): + configuration. Note that this is not a free license so it requires allowing + unfree licenses. + + configuration.nix: + nixpkgs.config.allowUnfree = true; + nixpkgs.config.joypixels.acceptLicense = true; + + config.nix: + allowUnfree = true; joypixels.acceptLicense = true; [1]: ${joypixels-free-license.url} From ca61c673810913b48cb7cd1b78fddf8f8b3ea041 Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 14 Aug 2020 18:44:54 +0200 Subject: [PATCH 12/15] joypixels: Drop dash from nixos endpoint url The url was changed on request. --- pkgs/data/fonts/joypixels/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index ab05cee885d..64d5973710a 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -13,7 +13,7 @@ let inherit (stdenv.hostPlatform.parsed) kernel; name = "joypixels-apple-color-emoji.ttc"; }; }.${kernel.name} or rec { - systemTag = "nix-os"; + systemTag = "nixos"; capitalized = "NixOS"; ext = "ttf"; fontFile = "joypixels-android.ttf"; From fd653b992ac92a758b85b9da83d817594b218493 Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 16 Aug 2020 21:02:02 +0200 Subject: [PATCH 13/15] 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; }`. --- pkgs/data/fonts/joypixels/default.nix | 59 ++++++++++++++------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index 64d5973710a..128fd69ced1 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -34,40 +34,41 @@ let inherit (stdenv.hostPlatform.parsed) kernel; free = false; }; + throwLicense = throw '' + Use of the JoyPixels font requires acceptance of the license. + - ${joypixels-free-license.fullName} [1] + - ${joypixels-license-appendix.fullName} [2] + + You can express acceptance by setting acceptLicense to true in your + configuration. Note that this is not a free license so it requires allowing + unfree licenses. + + configuration.nix: + nixpkgs.config.allowUnfree = true; + nixpkgs.config.joypixels.acceptLicense = true; + + config.nix: + allowUnfree = true; + joypixels.acceptLicense = true; + + [1]: ${joypixels-free-license.url} + [2]: ${joypixels-license-appendix.url} + ''; + in -assert !acceptLicense -> throw '' - Use of the JoyPixels font requires acceptance of the license. - - ${joypixels-free-license.fullName} [1] - - ${joypixels-license-appendix.fullName} [2] - - You can express acceptance by setting acceptLicense to true in your - configuration. Note that this is not a free license so it requires allowing - unfree licenses. - - configuration.nix: - nixpkgs.config.allowUnfree = true; - nixpkgs.config.joypixels.acceptLicense = true; - - config.nix: - allowUnfree = true; - joypixels.acceptLicense = true; - - [1]: ${joypixels-free-license.url} - [2]: ${joypixels-license-appendix.url} -''; - stdenv.mkDerivation rec { pname = "joypixels"; version = "6.0.0"; - src = with systemSpecific; fetchurl { - inherit name; - url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}"; - sha256 = { - darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; - }.${kernel.name} or "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; - }; + src = assert !acceptLicense -> throwLicense; + with systemSpecific; fetchurl { + inherit name; + url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}"; + sha256 = { + darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; + }.${kernel.name} or "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; + }; dontUnpack = true; @@ -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; From 196c828153ff15c18c7fe8635407d30afbb206c4 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 16 Sep 2020 22:37:17 +0200 Subject: [PATCH 14/15] joypixels: Use updated font for macOS After some back and forth with JoyPixels they agreed to creating a version of their font for macOS that does not use the exact same name as the Apple Color Emoji default font. This naming collision meant it was impossible to configure applications to use the JoyPixels emoji font unless you disabled the Apple Color Emoji font using Font Book. Which meant the JoyPixels font could either replace the Apple Color Emoji font completely or only fill in the gaps in that font (on my system "hot face" isn't in the system font) but not be used entirely for specific apps or be used with the system font as a back up. --- pkgs/data/fonts/joypixels/default.nix | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index 128fd69ced1..037e76315ce 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -8,16 +8,12 @@ let inherit (stdenv.hostPlatform.parsed) kernel; darwin = rec { systemTag = "nix-darwin"; capitalized = systemTag; - ext = "ttc"; - fontFile = "Apple%20Color%20Emoji.ttc"; - name = "joypixels-apple-color-emoji.ttc"; + fontFile = "JoyPixels-SBIX.ttf"; }; }.${kernel.name} or rec { systemTag = "nixos"; capitalized = "NixOS"; - ext = "ttf"; fontFile = "joypixels-android.ttf"; - name = fontFile; }; joypixels-free-license = with systemSpecific; { @@ -46,7 +42,7 @@ let inherit (stdenv.hostPlatform.parsed) kernel; configuration.nix: nixpkgs.config.allowUnfree = true; nixpkgs.config.joypixels.acceptLicense = true; - + config.nix: allowUnfree = true; joypixels.acceptLicense = true; @@ -63,17 +59,17 @@ stdenv.mkDerivation rec { src = assert !acceptLicense -> throwLicense; with systemSpecific; fetchurl { - inherit name; + name = fontFile; url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}"; sha256 = { - darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq"; + darwin = "1s1dibgpv4lc9cwbgykgwjxxhg2rbn5g9fyd10r6apj9xhfn8cyn"; }.${kernel.name} or "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s"; }; dontUnpack = true; installPhase = with systemSpecific; '' - install -Dm644 $src $out/share/fonts/truetype/joypixels.${ext} + install -Dm644 $src $out/share/fonts/truetype/${fontFile} ''; meta = with stdenv.lib; { From 5902a08028d420966fe8b713a26bf10353b947dc Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 22 Oct 2020 03:31:18 +0200 Subject: [PATCH 15/15] joypixels: run install hooks Also clean up formatting. --- pkgs/data/fonts/joypixels/default.nix | 95 +++++++++++++++------------ 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/pkgs/data/fonts/joypixels/default.nix b/pkgs/data/fonts/joypixels/default.nix index 037e76315ce..c19a55400fc 100644 --- a/pkgs/data/fonts/joypixels/default.nix +++ b/pkgs/data/fonts/joypixels/default.nix @@ -1,55 +1,58 @@ -{ stdenv, fetchurl, config +{ stdenv +, fetchurl +, config , acceptLicense ? config.joypixels.acceptLicense or false }: -let inherit (stdenv.hostPlatform.parsed) kernel; +let + inherit (stdenv.hostPlatform.parsed) kernel; - systemSpecific = { - darwin = rec { - systemTag = "nix-darwin"; - capitalized = systemTag; - fontFile = "JoyPixels-SBIX.ttf"; - }; - }.${kernel.name} or rec { - systemTag = "nixos"; - capitalized = "NixOS"; - fontFile = "joypixels-android.ttf"; - }; - - joypixels-free-license = with systemSpecific; { - spdxId = "LicenseRef-JoyPixels-Free-6.0"; - fullName = "JoyPixels Free License Agreement 6.0"; - url = "https://cdn.joypixels.com/distributions/${systemTag}/license/free-license.pdf"; - free = false; + systemSpecific = { + darwin = rec { + systemTag = "nix-darwin"; + capitalized = systemTag; + fontFile = "JoyPixels-SBIX.ttf"; }; + }.${kernel.name} or rec { + systemTag = "nixos"; + capitalized = "NixOS"; + fontFile = "joypixels-android.ttf"; + }; - joypixels-license-appendix = with systemSpecific; { - spdxId = "LicenseRef-JoyPixels-NixOS-Appendix"; - fullName = "JoyPixels ${capitalized} License Appendix"; - url = "https://cdn.joypixels.com/distributions/${systemTag}/appendix/joypixels-license-appendix.pdf"; - free = false; - }; + joypixels-free-license = with systemSpecific; { + spdxId = "LicenseRef-JoyPixels-Free-6.0"; + fullName = "JoyPixels Free License Agreement 6.0"; + url = "https://cdn.joypixels.com/distributions/${systemTag}/license/free-license.pdf"; + free = false; + }; - throwLicense = throw '' - Use of the JoyPixels font requires acceptance of the license. - - ${joypixels-free-license.fullName} [1] - - ${joypixels-license-appendix.fullName} [2] + joypixels-license-appendix = with systemSpecific; { + spdxId = "LicenseRef-JoyPixels-NixOS-Appendix"; + fullName = "JoyPixels ${capitalized} License Appendix"; + url = "https://cdn.joypixels.com/distributions/${systemTag}/appendix/joypixels-license-appendix.pdf"; + free = false; + }; - You can express acceptance by setting acceptLicense to true in your - configuration. Note that this is not a free license so it requires allowing - unfree licenses. + throwLicense = throw '' + Use of the JoyPixels font requires acceptance of the license. + - ${joypixels-free-license.fullName} [1] + - ${joypixels-license-appendix.fullName} [2] - configuration.nix: - nixpkgs.config.allowUnfree = true; - nixpkgs.config.joypixels.acceptLicense = true; + You can express acceptance by setting acceptLicense to true in your + configuration. Note that this is not a free license so it requires allowing + unfree licenses. - config.nix: - allowUnfree = true; - joypixels.acceptLicense = true; + configuration.nix: + nixpkgs.config.allowUnfree = true; + nixpkgs.config.joypixels.acceptLicense = true; - [1]: ${joypixels-free-license.url} - [2]: ${joypixels-license-appendix.url} - ''; + config.nix: + allowUnfree = true; + joypixels.acceptLicense = true; + + [1]: ${joypixels-free-license.url} + [2]: ${joypixels-license-appendix.url} + ''; in @@ -69,7 +72,11 @@ stdenv.mkDerivation rec { dontUnpack = true; installPhase = with systemSpecific; '' + runHook preInstall + install -Dm644 $src $out/share/fonts/truetype/${fontFile} + + runHook postInstall ''; meta = with stdenv.lib; { @@ -80,8 +87,10 @@ stdenv.mkDerivation rec { of files ranging from png, svg, iconjar, sprites, and fonts. ''; homepage = "https://www.joypixels.com/fonts"; - license = let free-license = joypixels-free-license; - appendix = joypixels-license-appendix; + license = + let + free-license = joypixels-free-license; + appendix = joypixels-license-appendix; in with systemSpecific; { spdxId = "LicenseRef-JoyPixels-Free-6.0-with-${capitalized}-Appendix"; fullName = "${free-license.fullName} with ${appendix.fullName}";