about summary refs log tree commit diff
path: root/pkgs/data/fonts/openmoji
diff options
context:
space:
mode:
authorFrancesco Gazzetta <fgaz@fgaz.me>2021-08-12 17:14:19 +0200
committerFrancesco Gazzetta <fgaz@fgaz.me>2021-08-12 17:15:53 +0200
commit12d2e28182a3ce6d29aad4f2fdb4134321da8e96 (patch)
treef5533266ee1917af7cab5957e8ab5f6234f2e22d /pkgs/data/fonts/openmoji
parentf1732edcd2ba9738ea9d5d626f052cb3b2cd9f15 (diff)
openmoji-color,openmoji-black: use upstream js builder
Diffstat (limited to 'pkgs/data/fonts/openmoji')
-rw-r--r--pkgs/data/fonts/openmoji/default.nix32
1 files changed, 9 insertions, 23 deletions
diff --git a/pkgs/data/fonts/openmoji/default.nix b/pkgs/data/fonts/openmoji/default.nix
index b2afde61bd646..d511a78f72503 100644
--- a/pkgs/data/fonts/openmoji/default.nix
+++ b/pkgs/data/fonts/openmoji/default.nix
@@ -2,6 +2,8 @@
 , stdenv
 , fetchFromGitHub
 , scfbuild
+, nodejs
+, nodePackages
 , python3Packages
 , variant ? "color" # "color" or "black"
 }:
@@ -25,36 +27,20 @@ in stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     scfbuild
+    nodejs
+    nodePackages.glob
+    nodePackages.lodash
   ];
 
   buildPhase = ''
-    # Bash reimplementation of helpers/export-svg-font.js
-    # so we don't need to build all the node deps first
-    hexcodes=()
-    missingGlyphBlack='./black/svg/25A1.svg'
-    missingGlyphColor='./color/svg/25A1.svg'
-    for f in ./color/svg/*.svg; do
-      basename=$(basename "$f" .svg)
-      hexcodes+=(''${basename//-/ })
-      filename=$(basename "$f");
-      cp "./color/svg/$filename" "./font/tmp-color/$filename"
-      cp "./black/svg/$filename" "./font/tmp-black/$filename"
-    done
+    runHook preBuild
 
-    hexcodes=($(uniq<<<"''${hexcodes[@]}"))
+    node helpers/generate-font-glyphs.js
 
-    for h in ''${hexcodes[@]}; do
-      filename="$h.svg"
-      if [ ! -e "./color/svg/$filename" ]; then
-        echo "$h is missing -> substitute with \"Missing Glyph\": $filename"
-        cp $missingGlyphColor "./font/tmp-color/$filename"
-        cp $missingGlyphBlack "./font/tmp-black/$filename"
-      fi
-    done
-
-    # Actually build the font:
     cd font
     scfbuild -c scfbuild-${variant}.yml
+
+    runHook postBuild
   '';
 
   installPhase = ''