nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 49 lines 1.6 kB view raw
1{ lib, stdenvNoCC, fetchurl, writeScript }: 2 3stdenvNoCC.mkDerivation rec { 4 pname = "i.ming"; 5 version = "8.00"; 6 7 src = fetchurl { 8 url = "https://raw.githubusercontent.com/ichitenfont/I.Ming/${version}/${version}/I.Ming-${version}.ttf"; 9 hash = "sha256-6345629OdKz6lTnD3Vjtp6DzsYy0ojaL0naXGrtdZvw="; 10 }; 11 12 dontUnpack = true; 13 14 installPhase = '' 15 runHook preInstall 16 17 install -DT -m444 $src $out/share/fonts/truetype/I.Ming/I.Ming.ttf 18 19 runHook postInstall 20 ''; 21 22 passthru = { 23 updateScript = writeScript "updater" '' 24 #!/usr/bin/env nix-shell 25 #!nix-shell -i bash -p curl gnused 26 set -e 27 version=$(curl -i -s https://github.com/ichitenfont/I.Ming/releases/latest | sed -n -E 's|^location.*releases/tag/([0-9.]+).*$|\1|p') 28 if [[ $version != ${version} ]]; then 29 tmp=$(mktemp -d) 30 curl -Lo $tmp/I.Ming.ttf https://raw.githubusercontent.com/ichitenfont/I.Ming/$version/$version/I.Ming-$version.ttf 31 install -DT -m444 $tmp/I.Ming.ttf $tmp/share/fonts/truetype/I.Ming/I.Ming.ttf 32 rm $tmp/I.Ming.ttf 33 hash=$(nix hash path --type sha256 --base32 --sri $tmp) 34 sed -i -E \ 35 -e "s/version = \"[0-9.]+\"/version = \"$version\"/" \ 36 -e "s|hash = \".*\"|hash = \"$hash\"|" \ 37 pkgs/data/fonts/i-dot-ming/default.nix 38 fi 39 ''; 40 }; 41 42 meta = with lib; { 43 description = "An open source Pan-CJK serif typeface"; 44 homepage = "https://github.com/ichitenfont/I.Ming"; 45 license = licenses.ipa; 46 platforms = platforms.all; 47 maintainers = [ maintainers.linsui ]; 48 }; 49}