2022-09-14 18:05:37 +00:00
|
|
|
{ lib, fetchurl, writeScript }:
|
2021-10-11 16:52:03 +00:00
|
|
|
|
|
|
|
let
|
2022-09-14 18:05:37 +00:00
|
|
|
version = "8.00";
|
2021-10-11 16:52:03 +00:00
|
|
|
in
|
2022-09-14 18:05:37 +00:00
|
|
|
fetchurl {
|
2021-10-11 16:52:03 +00:00
|
|
|
name = "i.ming-${version}";
|
|
|
|
url = "https://raw.githubusercontent.com/ichitenfont/I.Ming/${version}/${version}/I.Ming-${version}.ttf";
|
2022-09-14 18:05:37 +00:00
|
|
|
hash = "sha256-JGu9H0+IdJL6QQtLwvqlFLEaJdq1JVRiqLm5zptwjyE=";
|
2021-10-11 16:52:03 +00:00
|
|
|
|
2022-09-14 18:05:37 +00:00
|
|
|
recursiveHash = true;
|
|
|
|
downloadToTemp = true;
|
2021-10-11 16:52:03 +00:00
|
|
|
postFetch = ''
|
|
|
|
install -DT -m444 $downloadedFile $out/share/fonts/truetype/I.Ming/I.Ming.ttf
|
|
|
|
'';
|
|
|
|
|
2022-09-14 18:05:37 +00:00
|
|
|
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 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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-10-11 16:52:03 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "An open source Pan-CJK serif typeface";
|
|
|
|
homepage = "https://github.com/ichitenfont/I.Ming";
|
|
|
|
license = licenses.ipa;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = [ maintainers.linsui ];
|
|
|
|
};
|
|
|
|
}
|