From 259ad945e933b57a8f8ba13637c1beb37acb60f9 Mon Sep 17 00:00:00 2001 From: Ethan Carter Edwards Date: Sat, 6 Jun 2026 14:42:34 -0700 Subject: [PATCH] source-han-*: use installFonts, modernize Signed-off-by: Ethan Carter Edwards --- pkgs/data/fonts/source-han/default.nix | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pkgs/data/fonts/source-han/default.nix b/pkgs/data/fonts/source-han/default.nix index f68a2c75ca55..06554c1b9af0 100644 --- a/pkgs/data/fonts/source-han/default.nix +++ b/pkgs/data/fonts/source-han/default.nix @@ -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}";