nixpkgs/pkgs/data/fonts/gohufont/default.nix

72 lines
1.8 KiB
Nix
Raw Normal View History

2019-03-02 16:09:28 +01:00
{ stdenv, fetchurl, fetchFromGitHub
, mkfontdir, mkfontscale, bdf2psf, bdftopcf
}:
stdenv.mkDerivation rec {
2019-03-02 16:09:28 +01:00
name = "gohufont-${version}";
version = "2.1";
2019-03-02 16:09:28 +01:00
src = fetchurl {
url = "http://font.gohu.org/${name}.tar.gz";
sha256 = "10dsl7insnw95hinkcgmp9rx39lyzb7bpx5g70vswl8d6p4n53bm";
};
2019-03-02 16:09:28 +01:00
bdf = fetchFromGitHub {
owner = "hchargois";
repo = "gohufont";
rev = "cc36b8c9fed7141763e55dcee0a97abffcf08224";
sha256 = "1hmp11mrr01b29phw0xyj4h9b92qz19cf56ssf6c47c5j2c4xmbv";
2015-08-31 16:06:22 +02:00
};
2019-03-02 16:09:28 +01:00
nativeBuildInputs = [ mkfontdir mkfontscale bdf2psf bdftopcf ];
2015-08-31 16:06:22 +02:00
2019-03-02 16:09:28 +01:00
buildPhase = ''
2015-08-31 16:06:22 +02:00
# convert bdf to psf fonts
2019-03-02 16:09:28 +01:00
build=$(pwd)
2015-08-31 16:06:22 +02:00
mkdir psf
2019-03-02 16:09:28 +01:00
cd ${bdf2psf}/usr/share/bdf2psf
for i in $bdf/*.bdf; do
bdf2psf \
--fb "$i" standard.equivalents \
ascii.set+useful.set+linux.set 512 \
"$build/psf/$(basename $i .bdf).psf"
done
cd $build
2015-08-31 16:06:22 +02:00
2019-03-02 16:09:28 +01:00
# convert hidpi variant to pcf
for i in $bdf/hidpi/*.bdf; do
name=$(basename $i .bdf).pcf
bdftopcf -o "$name" "$i"
2015-08-31 16:06:22 +02:00
done
2019-03-02 16:09:28 +01:00
'';
2015-08-31 16:06:22 +02:00
2019-03-02 16:09:28 +01:00
installPhase = ''
2015-08-31 16:06:22 +02:00
# install the psf fonts (for the virtual console)
fontDir="$out/share/consolefonts"
mkdir -p "$fontDir"
2019-03-02 16:09:28 +01:00
mv -t "$fontDir" psf/*.psf
2015-08-31 16:06:22 +02:00
# install the pcf fonts (for xorg applications)
fontDir="$out/share/fonts/misc"
mkdir -p "$fontDir"
2019-03-02 16:09:28 +01:00
mv -t "$fontDir" *.pcf.gz *.pcf
2015-08-31 16:06:22 +02:00
cd "$fontDir"
mkfontdir
mkfontscale
'';
2017-08-10 21:43:49 +02:00
outputHashAlgo = "sha256";
outputHashMode = "recursive";
2019-03-02 16:09:28 +01:00
outputHash = "0kl7k8idl0fnsap2c4j02i33z017p2s4gi2cgspy6ica46fczcc1";
2017-08-10 21:43:49 +02:00
meta = with stdenv.lib; {
2015-08-31 16:06:22 +02:00
description = ''
A monospace bitmap font well suited for programming and terminal use
'';
2019-03-02 16:09:28 +01:00
homepage = http://font.gohu.org/;
license = licenses.wtfpl;
maintainers = with maintainers; [ epitrochoid rnhmjoj ];
};
}