Unverified Commit 68b20088 authored by ners's avatar ners
Browse files

ibm-plex: use installFonts hook

parent 4cf561b5
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@
  lib,
  stdenvNoCC,
  fetchzip,
  symlinkJoin,
  installFonts,
  families ? [ ],
}:
let
@@ -18,22 +20,23 @@ stdenvNoCC.mkDerivation {
  pname = "ibm-plex";
  inherit version;

  srcs = map (
  src = symlinkJoin {
    name = "ibm-plex-src";
    paths = map (
      family:
      fetchzip {
        url = "https://github.com/IBM/plex/releases/download/%40ibm%2Fplex-${family}%40${version}/ibm-plex-${family}.zip";
        hash = availableFamilies.${family};
      }
    ) selectedFamilies;
    postBuild = ''
      find "$out" \( -name hinted -or -name unhinted -or -name split \) -exec rm -fr {} +
    '';
  };

  dontUnpack = true;
  sourceRoot = ".";

  installPhase = ''
    runHook preInstall
    find $srcs -type f -name '*.otf' -exec install -Dm644 {} -t $out/share/fonts/opentype \;
    runHook postInstall
  '';
  nativeBuildInputs = [ installFonts ];

  passthru.updateScript = ./update.sh;