git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #139789 from linsui/source-han
commitdf4f7a4d8ff57056834291214113126397c436f5 authorSandro <sandro.jaeckel@gmail.com> dateThu 30 Sep 2021, 16:52 (5 years ago) parentc27f3d722aad26
1 file changed+31−25
pkgs/data/fonts/source-han/default.nix+31−25
pkgs/data/fonts/source-han/default.nix+31−25
@@ -1,55 +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;
20+ in
21+ fetchzip {
22+ name = "source-han-${family}-${lib.removeSuffix "R" rev}";
1223
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− mkdir -p $out/share/fonts/opentype/source-han-${family}
23− ln -s ${ttc} $out/share/fonts/opentype/source-han-${family}/SourceHan${Family}.ttc
24− '';
24+ url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/SourceHan${Family}.ttc${zip}";
25+ inherit sha256 postFetch;
2526
26− meta = {
27− description = "An open source Pan-CJK ${description} typeface";
28− homepage = "https://github.com/adobe-fonts/source-han-${family}";
29− license = lib.licenses.ofl;
30− maintainers = with lib.maintainers; [ taku0 emily ];
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+ };
3133 };
32− };
3334in
3435{
3536 sans = makePackage {
3637 family = "sans";
3738 description = "sans-serif";
38− rev = "2.001R";
39− sha256 = "101p8q0sagf1sd1yzwdrmmxvkqq7j0b8hi0ywsfck9w56r4zx54y";
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
44+ '';
45+ zip = ".zip";
4046 };
4147
4248 serif = makePackage {
4349 family = "serif";
4450 description = "serif";
4551 rev = "1.001R";
46− sha256 = "1d968h30qvvwy3s77m9y3f1glq8zlr6bnfw00yinqa18l97n7k45";
52+ sha256 = "0nnsb2w140ih0cnp1fh7s4csvzp9y0cavz9df2ryhv215mh9z4m0";
4753 };
4854
4955 mono = makePackage {
5056 family = "mono";
5157 description = "monospaced";
5258 rev = "1.002";
53− sha256 = "1haqffkcgz0cc24y8rc9bg36v8x9hdl8fdl3xc8qz14hvr42868c";
59+ sha256 = "010h1y469c21bjavwdmkpbwk3ny686inz8i062wh1dhcv8cnqk3c";
5460 };
5561}