main
 1{
 2  lib,
 3  stdenvNoCC,
 4  fetchurl,
 5  installFonts,
 6  nix-update-script,
 7}: let
 8  version = "1.070";
 9
10  main = fetchurl {
11    url = "https://github.com/lxgw/LxgwNeoZhiSong/releases/download/v${version}/LXGWNeoZhiSong.ttf";
12    hash = "sha256-xCAAtZyv/ozPzRyQqihB3K+oZs8kdpzBsQw3CMZx8gc=";
13  };
14
15  plus = fetchurl {
16    url = "https://github.com/lxgw/LxgwNeoZhiSong/releases/download/v${version}/LXGWNeoZhiSongPlus.ttf";
17    hash = "sha256-MBHawdaPffIsmuSpG+7TI91yZsCynanxxUAkJSK2jww=";
18  };
19in
20  stdenvNoCC.mkDerivation {
21    pname = "lxgw-neozhisong";
22    inherit version;
23
24    src = main;
25
26    dontUnpack = true;
27
28    nativeBuildInputs = [installFonts];
29
30    preInstall = ''
31      install -m644 ${main} LXGWNeoZhiSong.ttf
32      install -m644 ${plus} LXGWNeoZhiSongPlus.ttf
33    '';
34
35    passthru = {
36      inherit plus;
37      updateScript = nix-update-script {
38        extraArgs = ["--custom-dep" "plus"];
39      };
40    };
41
42    preferLocalBuild = true;
43
44    meta = {
45      homepage = "https://github.com/lxgw/LxgwNeoZhiSong";
46      description = "Chinese serif font derived from IPAex Mincho and IPAmj Mincho";
47      license = lib.licenses.ipa;
48      platforms = lib.platforms.all;
49    };
50  }