summary refs log tree commit diff
path: root/pkgs/data/fonts/gohufont/default.nix
blob: 7936a216ada7ef03d54af05aa633ba46656b1a5a (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ stdenv, fetchurl, mkfontdir, mkfontscale, bdf2psf }:

stdenv.mkDerivation rec {
  name = "gohufont-2.0";

  pcf = fetchurl {
    url = "http://font.gohu.org/gohufont-2.0.tar.gz";
    sha256 = "0vi87fvj3m52piz2k6vqday03cah6zvz3dzrvjch3qjna1i1nb7s";
  };

  bdf = fetchurl {
    url = "http://font.gohu.org/gohufont-bdf-2.0.tar.gz";
    sha256 = "0rqqavhqbs7pajcblg92mjlz2dxk8b60vgdh271axz7kjs2wf9mr";
  };

  nativeBuildInputs = [ mkfontdir mkfontscale bdf2psf ];

  unpackPhase = ''
    mkdir pcf bdf
    tar -xzf $pcf --strip-components=1 -C pcf
    tar -xzf $bdf --strip-components=1 -C bdf
  '';

  installPhase = ''
    # convert bdf to psf fonts
    sourceRoot="$(pwd)"
    mkdir psf

    cd "${bdf2psf}/usr/share/bdf2psf"
    for i in $sourceRoot/bdf/*.bdf; do
      bdf2psf --fb $i standard.equivalents \
                      ascii.set+useful.set+linux.set 512 \
                      "$sourceRoot/psf/$(basename $i .bdf).psf"
    done
    cd "$sourceRoot"

    # install the psf fonts (for the virtual console)
    fontDir="$out/share/consolefonts"
    mkdir -p "$fontDir"
    mv psf/*.psf "$fontDir"


    # install the pcf fonts (for xorg applications)
    fontDir="$out/share/fonts/misc"
    mkdir -p "$fontDir"
    mv pcf/*.pcf.gz "$fontDir"

    cd "$fontDir"
    mkfontdir
    mkfontscale
  '';

  outputHashAlgo = "sha256";
  outputHashMode = "recursive";
  outputHash = "0msl5y9q6hjbhc85v121x1b1rhsh2rbqqy4k234i5mpp8l3087r7";

  meta = with stdenv.lib; {
    description = ''
      A monospace bitmap font well suited for programming and terminal use
    '';
    homepage = http://font.gohu.org/;
    license = licenses.wtfpl;
    maintainers = with maintainers; [ epitrochoid ];
    platforms = platforms.linux;
  };
}