@@ -1,72 +1,61 @@
11{ stdenvNoCC
22, lib
33, fetchzip
4−, fetchurl
54}:
65
76let
8− makePackage = { family, description, rev, sha256 }: let
9− Family =
7+ makePackage =
8+ { family
9+ , description
10+ , rev
11+ , sha256
12+ , postFetch ? ''
13+ install -m444 -Dt $out/share/fonts/opentype/source-han-${family} $downloadedFile
14+ ''
15+ , zip ? ""
16+ }:
17+ let Family =
1018 lib.toUpper (lib.substring 0 1 family) +
1119 lib.substring 1 (lib.stringLength family) family;
12−
13− ttc = fetchurl {
14− url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/SourceHan${Family}.ttc";
15− inherit sha256;
16− };
17− in stdenvNoCC.mkDerivation {
18− pname = "source-han-${family}";
19− version = lib.removeSuffix "R" rev;
20−
21− buildCommand = ''
22− install -m444 -Dt $out/share/fonts/opentype/source-han-${family} ${ttc}
23− '';
24−
25− meta = {
26− description = "An open source Pan-CJK ${description} typeface";
27− homepage = "https://github.com/adobe-fonts/source-han-${family}";
28− license = lib.licenses.ofl;
29− maintainers = with lib.maintainers; [ taku0 emily ];
20+ in
21+ fetchzip {
22+ name = "source-han-${family}-${lib.removeSuffix "R" rev}";
23+
24+ url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/SourceHan${Family}.ttc${zip}";
25+ inherit sha256 postFetch;
26+
27+ meta = {
28+ description = "An open source Pan-CJK ${description} typeface";
29+ homepage = "https://github.com/adobe-fonts/source-han-${family}";
30+ license = lib.licenses.ofl;
31+ maintainers = with lib.maintainers; [ taku0 emily ];
32+ };
3033 };
31− };
3234in
3335{
34− sans = let
35− rev = "2.004R";
36+ sans = makePackage {
3637 family = "sans";
37− Family = "Sans";
38− zip = fetchzip {
39− url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/SourceHan${Family}.ttc.zip";
40− stripRoot = false;
41− sha256 = "0z852kzb84vqk57icfaxbfxhf43awcn8w39byfypxaxigzhy78l7";
42− };
43− in stdenvNoCC.mkDerivation {
44− pname = "source-han-sans";
45− version = lib.removeSuffix "R" rev;
46−
47− buildCommand = ''
48− install -m444 -Dt $out/share/fonts/opentype/source-han-sans ${zip}/SourceHanSans.ttc
38+ description = "sans-serif";
39+ rev = "2.004R";
40+ sha256 = "052d17hvz435zc4r2y1p9cgkkgn0ps8g74mfbvnbm1pv8ykj40m9";
41+ postFetch = ''
42+ mkdir -p $out/share/fonts/opentype/source-han-sans
43+ unzip $downloadedFile -d $out/share/fonts/opentype/source-han-sans
4944 '';
50−
51− meta = {
52− description = "An open source Pan-CJK sans-serif typeface";
53− homepage = "https://github.com/adobe-fonts/source-han-${family}";
54− license = lib.licenses.ofl;
55− maintainers = with lib.maintainers; [ taku0 emily ];
56− };
45+ zip = ".zip";
5746 };
5847
5948 serif = makePackage {
6049 family = "serif";
6150 description = "serif";
6251 rev = "1.001R";
63− sha256 = "1d968h30qvvwy3s77m9y3f1glq8zlr6bnfw00yinqa18l97n7k45";
52+ sha256 = "0nnsb2w140ih0cnp1fh7s4csvzp9y0cavz9df2ryhv215mh9z4m0";
6453 };
6554
6655 mono = makePackage {
6756 family = "mono";
6857 description = "monospaced";
6958 rev = "1.002";
70− sha256 = "1haqffkcgz0cc24y8rc9bg36v8x9hdl8fdl3xc8qz14hvr42868c";
59+ sha256 = "010h1y469c21bjavwdmkpbwk3ny686inz8i062wh1dhcv8cnqk3c";
7160 };
7261}