From d33814099cbb61f17f3c6ac215af2edf2174fda7 Mon Sep 17 00:00:00 2001 From: pancaek <20342389+pancaek@users.noreply.github.com> Date: Wed, 17 Jun 2026 13:38:15 -0700 Subject: [PATCH] i-dot-ming: fetch all fonts, fix update script, use installFonts --- pkgs/by-name/i-/i-dot-ming/package.nix | 46 ++++++++------------------ 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/pkgs/by-name/i-/i-dot-ming/package.nix b/pkgs/by-name/i-/i-dot-ming/package.nix index 3f3a486b4d87..915c09944b96 100644 --- a/pkgs/by-name/i-/i-dot-ming/package.nix +++ b/pkgs/by-name/i-/i-dot-ming/package.nix @@ -1,47 +1,27 @@ { lib, stdenvNoCC, - fetchurl, - writeScript, + fetchFromGitHub, + installFonts, + nix-update-script, }: -stdenvNoCC.mkDerivation rec { +stdenvNoCC.mkDerivation (finalAttrs: { pname = "i.ming"; version = "8.10"; - src = fetchurl { - url = "https://raw.githubusercontent.com/ichitenfont/I.Ming/${version}/${version}/I.Ming-${version}.ttf"; - hash = "sha256-y6E7dbBQ1nG2EdAGMUcmLkIeFDWa1FMJSLBw9WER8PM="; + src = fetchFromGitHub { + owner = "ichitenfont"; + repo = "I.Ming"; + tag = finalAttrs.version; + hash = "sha256-TutIcX/DoeO5cwjD0o1IaXErStY73Cqk00NDKbXw39I="; + rootDir = finalAttrs.version; }; - dontUnpack = true; - - installPhase = '' - runHook preInstall - - install -DT -m444 $src $out/share/fonts/truetype/I.Ming/I.Ming.ttf - - runHook postInstall - ''; + nativeBuildInputs = [ installFonts ]; passthru = { - updateScript = writeScript "updater" '' - #!/usr/bin/env nix-shell - #!nix-shell -i bash -p curl gnused - set -e - version=$(curl -i -s https://github.com/ichitenfont/I.Ming/releases/latest | sed -n -E 's|^location.*releases/tag/([0-9.]+).*$|\1|p') - if [[ $version != ${version} ]]; then - tmp=$(mktemp -d) - curl -Lo $tmp/I.Ming.ttf https://raw.githubusercontent.com/ichitenfont/I.Ming/$version/$version/I.Ming-$version.ttf - install -DT -m444 $tmp/I.Ming.ttf $tmp/share/fonts/truetype/I.Ming/I.Ming.ttf - rm $tmp/I.Ming.ttf - hash=$(nix --extra-experimental-features nix-command hash path --type sha256 --base32 --sri $tmp) - sed -i -E \ - -e "s/version = \"[0-9.]+\"/version = \"$version\"/" \ - -e "s|hash = \".*\"|hash = \"$hash\"|" \ - pkgs/data/fonts/i-dot-ming/default.nix - fi - ''; + updateScript = nix-update-script { }; }; meta = { @@ -51,4 +31,4 @@ stdenvNoCC.mkDerivation rec { platforms = lib.platforms.all; maintainers = [ lib.maintainers.linsui ]; }; -} +})