source-han-*: use installFonts, modernize (#528954)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
fetchurl,
|
||||
installFonts,
|
||||
unzip,
|
||||
}:
|
||||
|
||||
@@ -18,16 +19,19 @@ let
|
||||
let
|
||||
Family = lib.toUpper (lib.substring 0 1 family) + lib.substring 1 (lib.stringLength family) family;
|
||||
in
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "source-han-${family}";
|
||||
version = lib.removeSuffix "R" rev;
|
||||
|
||||
__structuredAttrs = true;
|
||||
strictDeps = true;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/${prefix}SourceHan${Family}.ttc${zip}";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = lib.optionals (zip == ".zip") [ unzip ];
|
||||
nativeBuildInputs = [ installFonts ] ++ lib.optionals (zip == ".zip") [ unzip ];
|
||||
|
||||
unpackPhase =
|
||||
lib.optionalString (zip == "") ''
|
||||
@@ -37,14 +41,6 @@ let
|
||||
unzip $src
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm444 *.ttc -t $out/share/fonts/opentype/${pname}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Open source Pan-CJK ${description} typeface";
|
||||
homepage = "https://github.com/adobe-fonts/source-han-${family}";
|
||||
|
||||
Reference in New Issue
Block a user