3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/data/fonts/gohufont/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

70 lines
1.7 KiB
Nix

{ lib, stdenv, fetchurl, fetchFromGitHub
, mkfontscale, bdf2psf, bdftopcf
, fonttosfnt, libfaketime
}:
stdenv.mkDerivation rec {
pname = "gohufont";
version = "2.1";
src = fetchFromGitHub {
owner = "hchargois";
repo = "gohufont";
rev = "cc36b8c9fed7141763e55dcee0a97abffcf08224";
sha256 = "1hmp11mrr01b29phw0xyj4h9b92qz19cf56ssf6c47c5j2c4xmbv";
};
nativeBuildInputs =
[ mkfontscale bdf2psf bdftopcf
fonttosfnt libfaketime
];
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
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"
done
'';
installPhase = ''
# install the psf fonts (for the virtual console)
fontDir="$out/share/consolefonts"
install -D -m 644 -t "$fontDir" psf/*.psf
# 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; {
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 ];
};
}