mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 17:43:42 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
50 lines
1.6 KiB
Nix
50 lines
1.6 KiB
Nix
{ lib, stdenvNoCC, fetchurl, writeScript }:
|
|
|
|
stdenvNoCC.mkDerivation rec {
|
|
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=";
|
|
};
|
|
|
|
dontUnpack = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -DT -m444 $src $out/share/fonts/truetype/I.Ming/I.Ming.ttf
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
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
|
|
'';
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Open source Pan-CJK serif typeface";
|
|
homepage = "https://github.com/ichitenfont/I.Ming";
|
|
license = licenses.ipa;
|
|
platforms = platforms.all;
|
|
maintainers = [ maintainers.linsui ];
|
|
};
|
|
}
|