nixpkgs/pkgs/data/fonts/gohufont/default.nix
2020-02-07 09:34:51 +01:00

71 lines
1.7 KiB
Nix

{ stdenv, fetchurl, fetchFromGitHub
, mkfontdir, mkfontscale, bdf2psf, bdftopcf
, fonttosfnt
}:
stdenv.mkDerivation rec {
pname = "gohufont";
version = "2.1";
src = fetchFromGitHub {
owner = "hchargois";
repo = "gohufont";
rev = "cc36b8c9fed7141763e55dcee0a97abffcf08224";
sha256 = "1hmp11mrr01b29phw0xyj4h9b92qz19cf56ssf6c47c5j2c4xmbv";
};
nativeBuildInputs =
[ mkfontdir mkfontscale bdf2psf bdftopcf fonttosfnt ];
buildPhase = ''
# convert bdf fonts to psf
build=$(pwd)
mkdir psf
cd ${bdf2psf}/share/bdf2psf
for i in $src/*.bdf; do
name=$(basename $i .bdf)
bdf2psf \
--fb "$i" standard.equivalents \
ascii.set+useful.set+linux.set 512 \
"$build/psf/$name.psf"
done
cd $build
# convert bdf fonts to pcf and otb
for i in *.bdf $src/hidpi/*.bdf; do
name=$(basename $i .bdf)
bdftopcf -o "$name.pcf" "$i"
fonttosfnt -v -o "$name.otb" "$i" || true
done
'';
installPhase = ''
# install the psf fonts (for the virtual console)
fontDir="$out/share/consolefonts"
mkdir -p "$fontDir"
mv -t "$fontDir" psf/*.psf
# install the pcf and otb fonts (for xorg applications)
fontDir="$out/share/fonts/misc"
mkdir -p "$fontDir"
mv -t "$fontDir" *.pcf *.otb
cd "$fontDir"
mkfontdir
mkfontscale
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "0j9fhvzkascpb5y8lc1pmmmgd74apgw9mimbj0bk2chcbfsi852p";
meta = with stdenv.lib; {
description = ''
A monospace bitmap font well suited for programming and terminal use
'';
homepage = https://font.gohu.org/;
license = licenses.wtfpl;
maintainers = with maintainers; [ epitrochoid rnhmjoj ];
};
}