nixpkgs/pkgs/by-name/go/gohufont/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

70 lines
1.7 KiB
Nix

{ lib, stdenv, fetchFromGitHub
, xorg, bdf2psf, bdftopcf
, libfaketime
}:
stdenv.mkDerivation rec {
pname = "gohufont";
version = "2.1";
src = fetchFromGitHub {
owner = "hchargois";
repo = "gohufont";
rev = "cc36b8c9fed7141763e55dcee0a97abffcf08224";
sha256 = "1hmp11mrr01b29phw0xyj4h9b92qz19cf56ssf6c47c5j2c4xmbv";
};
nativeBuildInputs =
[ xorg.mkfontscale bdf2psf bdftopcf
xorg.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; [ rnhmjoj ];
};
}