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

70 lines
1.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, fetchFromGitHub
, mkfontscale, bdf2psf, bdftopcf
, fonttosfnt, libfaketime
2019-03-02 15:09:28 +00:00
}:
stdenv.mkDerivation rec {
pname = "gohufont";
2019-03-02 15:09:28 +00:00
version = "2.1";
2019-12-07 16:22:14 +00:00
src = fetchFromGitHub {
2019-03-02 15:09:28 +00:00
owner = "hchargois";
repo = "gohufont";
rev = "cc36b8c9fed7141763e55dcee0a97abffcf08224";
sha256 = "1hmp11mrr01b29phw0xyj4h9b92qz19cf56ssf6c47c5j2c4xmbv";
2015-08-31 14:06:22 +00:00
};
2019-12-07 16:22:14 +00:00
nativeBuildInputs =
[ mkfontscale bdf2psf bdftopcf
fonttosfnt libfaketime
];
2015-08-31 14:06:22 +00:00
2019-03-02 15:09:28 +00:00
buildPhase = ''
2019-12-07 16:22:14 +00:00
# convert bdf fonts to psf
2019-03-02 15:09:28 +00:00
build=$(pwd)
2015-08-31 14:06:22 +00:00
mkdir psf
cd ${bdf2psf}/share/bdf2psf
2019-12-07 16:22:14 +00:00
for i in $src/*.bdf; do
name=$(basename $i .bdf)
2019-03-02 15:09:28 +00:00
bdf2psf \
--fb "$i" standard.equivalents \
ascii.set+useful.set+linux.set 512 \
2019-12-07 16:22:14 +00:00
"$build/psf/$name.psf"
2019-03-02 15:09:28 +00:00
done
cd $build
2015-08-31 14:06:22 +00:00
# convert bdf fonts to pcf
2019-12-07 16:22:14 +00:00
for i in *.bdf $src/hidpi/*.bdf; do
name=$(basename $i .bdf)
bdftopcf -o "$name.pcf" "$i"
done
# convert unicode bdf fonts to otb
for i in *-uni*.bdf $src/hidpi/*-uni*.bdf; do
name=$(basename $i .bdf)
faketime -f "1970-01-01 00:00:01" \
fonttosfnt -v -o "$name.otb" "$i"
2015-08-31 14:06:22 +00:00
done
2019-03-02 15:09:28 +00:00
'';
2015-08-31 14:06:22 +00:00
2019-03-02 15:09:28 +00:00
installPhase = ''
2015-08-31 14:06:22 +00:00
# install the psf fonts (for the virtual console)
fontDir="$out/share/consolefonts"
install -D -m 644 -t "$fontDir" psf/*.psf
2015-08-31 14:06:22 +00:00
# install the pcf and otb fonts (for X11,GTK applications)
fontDir="$out/share/fonts/misc"
install -D -m 644 -t "$fontDir" *.pcf *.otb
mkfontdir "$fontDir"
'';
meta = with lib; {
2015-08-31 14:06:22 +00:00
description = ''
A monospace bitmap font well suited for programming and terminal use
'';
homepage = "https://font.gohu.org/";
2019-03-02 15:09:28 +00:00
license = licenses.wtfpl;
maintainers = with maintainers; [ epitrochoid rnhmjoj ];
};
}