go-font: Fetch only the installables instead of entire blobs repo

Switch to using `fetchzip` to download a subdirectory tarball including
TrueType fonts and their license instead of cloning Go's 'images'
repository.

- Simplifies the derivation
- Downloads 900K instead of 28M
- Requires 1/8 CPU cycles
- ...shortening the build time.
This commit is contained in:
Berk D. Demir 2022-11-03 00:25:58 -07:00 committed by sternenseemann
parent 8aa59fb1b0
commit bfde85769e

View File

@ -1,20 +1,18 @@
{ lib, fetchgit }: { lib, fetchzip }:
let let
version = "2.010"; version = "2.010";
in (fetchgit {
name = "go-font-${version}";
url = "https://go.googlesource.com/image";
rev = "41969df76e82aeec85fa3821b1e24955ea993001"; rev = "41969df76e82aeec85fa3821b1e24955ea993001";
in (fetchzip {
name = "go-font-${version}";
url = "https://go.googlesource.com/image/+archive/${rev}/font/gofont/ttfs.tar.gz";
stripRoot = false;
postFetch = '' postFetch = ''
mv $out source
cd source
mkdir -p $out/share/fonts/truetype mkdir -p $out/share/fonts/truetype
mkdir -p $out/share/doc/go-font mkdir -p $out/share/doc/go-font
cp font/gofont/ttfs/* $out/share/fonts/truetype mv $out/*.ttf $out/share/fonts/truetype
mv $out/share/fonts/truetype/README $out/share/doc/go-font/LICENSE mv $out/README $out/share/doc/go-font/LICENSE
''; '';
sha256 = "175jwq16qjnd2k923n9gcbjizchy7yv4n41dm691sjwrhbl0b13x"; sha256 = "175jwq16qjnd2k923n9gcbjizchy7yv4n41dm691sjwrhbl0b13x";