source-han-*: use fetchzip instead of mkDerivation
This commit is contained in:
parent
0901b41056
commit
22aad26526
1 changed files with 33 additions and 44 deletions
|
@ -1,26 +1,28 @@
|
||||||
{ stdenvNoCC
|
{ stdenvNoCC
|
||||||
, lib
|
, lib
|
||||||
, fetchzip
|
, fetchzip
|
||||||
, fetchurl
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
makePackage = { family, description, rev, sha256 }: let
|
makePackage =
|
||||||
Family =
|
{ family
|
||||||
|
, description
|
||||||
|
, rev
|
||||||
|
, sha256
|
||||||
|
, postFetch ? ''
|
||||||
|
install -m444 -Dt $out/share/fonts/opentype/source-han-${family} $downloadedFile
|
||||||
|
''
|
||||||
|
, zip ? ""
|
||||||
|
}:
|
||||||
|
let Family =
|
||||||
lib.toUpper (lib.substring 0 1 family) +
|
lib.toUpper (lib.substring 0 1 family) +
|
||||||
lib.substring 1 (lib.stringLength family) family;
|
lib.substring 1 (lib.stringLength family) family;
|
||||||
|
in
|
||||||
|
fetchzip {
|
||||||
|
name = "source-han-${family}-${lib.removeSuffix "R" rev}";
|
||||||
|
|
||||||
ttc = fetchurl {
|
url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/SourceHan${Family}.ttc${zip}";
|
||||||
url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/SourceHan${Family}.ttc";
|
inherit sha256 postFetch;
|
||||||
inherit sha256;
|
|
||||||
};
|
|
||||||
in stdenvNoCC.mkDerivation {
|
|
||||||
pname = "source-han-${family}";
|
|
||||||
version = lib.removeSuffix "R" rev;
|
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
install -m444 -Dt $out/share/fonts/opentype/source-han-${family} ${ttc}
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "An open source Pan-CJK ${description} typeface";
|
description = "An open source Pan-CJK ${description} typeface";
|
||||||
|
@ -31,42 +33,29 @@ let
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
sans = let
|
sans = makePackage {
|
||||||
rev = "2.004R";
|
|
||||||
family = "sans";
|
family = "sans";
|
||||||
Family = "Sans";
|
description = "sans-serif";
|
||||||
zip = fetchzip {
|
rev = "2.004R";
|
||||||
url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/SourceHan${Family}.ttc.zip";
|
sha256 = "052d17hvz435zc4r2y1p9cgkkgn0ps8g74mfbvnbm1pv8ykj40m9";
|
||||||
stripRoot = false;
|
postFetch = ''
|
||||||
sha256 = "0z852kzb84vqk57icfaxbfxhf43awcn8w39byfypxaxigzhy78l7";
|
mkdir -p $out/share/fonts/opentype/source-han-sans
|
||||||
};
|
unzip $downloadedFile -d $out/share/fonts/opentype/source-han-sans
|
||||||
in stdenvNoCC.mkDerivation {
|
|
||||||
pname = "source-han-sans";
|
|
||||||
version = lib.removeSuffix "R" rev;
|
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
install -m444 -Dt $out/share/fonts/opentype/source-han-sans ${zip}/SourceHanSans.ttc
|
|
||||||
'';
|
'';
|
||||||
|
zip = ".zip";
|
||||||
meta = {
|
|
||||||
description = "An open source Pan-CJK sans-serif typeface";
|
|
||||||
homepage = "https://github.com/adobe-fonts/source-han-${family}";
|
|
||||||
license = lib.licenses.ofl;
|
|
||||||
maintainers = with lib.maintainers; [ taku0 emily ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
serif = makePackage {
|
serif = makePackage {
|
||||||
family = "serif";
|
family = "serif";
|
||||||
description = "serif";
|
description = "serif";
|
||||||
rev = "1.001R";
|
rev = "1.001R";
|
||||||
sha256 = "1d968h30qvvwy3s77m9y3f1glq8zlr6bnfw00yinqa18l97n7k45";
|
sha256 = "0nnsb2w140ih0cnp1fh7s4csvzp9y0cavz9df2ryhv215mh9z4m0";
|
||||||
};
|
};
|
||||||
|
|
||||||
mono = makePackage {
|
mono = makePackage {
|
||||||
family = "mono";
|
family = "mono";
|
||||||
description = "monospaced";
|
description = "monospaced";
|
||||||
rev = "1.002";
|
rev = "1.002";
|
||||||
sha256 = "1haqffkcgz0cc24y8rc9bg36v8x9hdl8fdl3xc8qz14hvr42868c";
|
sha256 = "010h1y469c21bjavwdmkpbwk3ny686inz8i062wh1dhcv8cnqk3c";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue