about summary refs log tree commit diff
path: root/pkgs/data/fonts/dosemu-fonts/default.nix
blob: 08888767c7712c6741ecffd894860c2892c1c914 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ stdenv, fetchurl, bdftopcf, mkfontdir, mkfontscale }:

stdenv.mkDerivation rec {
  name = "dosemu-fonts-${version}";
  version = "1.4.0";

  src = fetchurl {
    url = "mirror://sourceforge/dosemu/dosemu-${version}.tgz";
    sha256 = "0l1zwmw42mpakjrzmbygshcg2qzq9mv8lx42738rz3j9hrqzg4pw";
  };

  buildCommand = ''
    tar xf "$src" --anchored --wildcards '*/etc/*.bdf' '*/etc/dosemu.alias'
    fontPath="$out/share/fonts/X11/misc/dosemu"
    mkdir -p "$fontPath"
    for i in */etc/*.bdf; do
      fontOut="$out/share/fonts/X11/misc/dosemu/$(basename "$i" .bdf).pcf.gz"
      echo -n "Installing font $fontOut..." >&2
      ${bdftopcf}/bin/bdftopcf $i | gzip -c -9 > "$fontOut"
      echo " done." >&2
    done
    cp */etc/dosemu.alias "$fontPath/fonts.alias"
    cd "$fontPath"
    ${mkfontdir}/bin/mkfontdir
    ${mkfontscale}/bin/mkfontscale
  '';

  meta = {
    description = "Various fonts from the DOSEmu project";
  };
}