nixpkgs/pkgs/data/fonts/dina/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

65 lines
1.8 KiB
Nix

{ lib, stdenv, fetchurl, unzip
, bdftopcf, mkfontscale, fontforge
}:
stdenv.mkDerivation {
pname = "dina-font";
version = "2.92";
src = fetchurl {
url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip";
sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z";
};
nativeBuildInputs =
[ unzip bdftopcf mkfontscale fontforge ];
patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf";
buildPhase = ''
newName() {
test "''${1:5:1}" = i && _it=Italic || _it=
case ''${1:6:3} in
400) test -z $it && _weight=Medium ;;
700) _weight=Bold ;;
esac
_pt=''${1%.bdf}
_pt=''${_pt#*-}
echo "Dina$_weight$_it$_pt"
}
# convert bdf fonts to pcf
for i in *.bdf; do
bdftopcf -t -o $(newName "$i").pcf "$i"
done
gzip -n -9 *.pcf
# convert bdf fonts to otb
for i in *.bdf; do
fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$(newName $i).otb\")"
done
'';
installPhase = ''
install -D -m 644 -t "$out/share/fonts/misc" *.pcf.gz *.otb
install -D -m 644 -t "$bdf/share/fonts/misc" *.bdf
mkfontdir "$out/share/fonts/misc"
mkfontdir "$bdf/share/fonts/misc"
'';
outputs = [ "out" "bdf" ];
meta = with lib; {
description = "A monospace bitmap font aimed at programmers";
longDescription = ''
Dina is a monospace bitmap font, primarily aimed at programmers. It is
relatively compact to allow a lot of code on screen, while (hopefully)
clear enough to remain readable even at high resolutions.
'';
homepage = "https://www.donationcoder.com/Software/Jibz/Dina/";
downloadPage = "https://www.donationcoder.com/Software/Jibz/Dina/";
license = licenses.free;
maintainers = [ maintainers.prikhi ];
};
}