3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/data/fonts/gohufont/default.nix

77 lines
1.9 KiB
Nix
Raw Normal View History

2019-03-02 15:09:28 +00:00
{ 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 15:06:22 +01:00
};
2019-12-07 16:22:14 +00:00
nativeBuildInputs =
[ mkfontscale bdf2psf bdftopcf
fonttosfnt libfaketime
];
2015-08-31 15:06:22 +01: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 15:06:22 +01: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 15:06:22 +01: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 15:06:22 +01:00
done
2019-03-02 15:09:28 +00:00
'';
2015-08-31 15:06:22 +01:00
2019-03-02 15:09:28 +00:00
installPhase = ''
2015-08-31 15:06:22 +01:00
# install the psf fonts (for the virtual console)
fontDir="$out/share/consolefonts"
install -D -m 644 -t "$fontDir" psf/*.psf
2015-08-31 15:06:22 +01:00
# install the pcf fonts (for xorg applications)
fontDir="$out/share/fonts/misc"
install -D -m 644 -t "$fontDir" *.pcf
mkfontdir "$fontDir"
2015-08-31 15:06:22 +01:00
# install the otb fonts (for gtk applications)
fontDir="$otb/share/fonts/misc"
install -D -m 644 -t "$fontDir" *.otb
mkfontdir "$fontDir"
'';
outputs = [ "out" "otb" ];
2017-08-10 20:43:49 +01:00
meta = with stdenv.lib; {
2015-08-31 15:06:22 +01: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 ];
};
}