summary refs log tree commit diff
path: root/pkgs/data/fonts/tewi/default.nix
blob: 1cf31b5affe7651bcaf310f21492e9935351b9bd (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
{ lib, stdenv, fetchFromGitHub, python3
, bdftopcf, mkfontscale
, libfaketime, fonttosfnt
}:

stdenv.mkDerivation rec {
  pname = "tewi-font";
  version = "2.0.2";

  src = fetchFromGitHub {
    owner  = "lucy";
    repo   = pname;
    rev    = version;
    sha256 = "1axv9bv10xlcmgfyjh3z5kn5fkg3m6n1kskcs5hvlmyb6m1zk91j";
  };

  nativeBuildInputs =
    [ python3 bdftopcf mkfontscale
      libfaketime fonttosfnt
    ];

  postPatch = ''
    # make gzip deterministic
    sed 's/gzip -9/gzip -9 -n/g' -i Makefile

    # fix python not found
    patchShebangs scripts/merge
  '';

  postBuild = ''
    # convert bdf fonts to otb
    for i in *.bdf; do
      name=$(basename "$i" .bdf)
      faketime -f "1970-01-01 00:00:01" \
      fonttosfnt -v -o "$name.otb" "$i"
    done
  '';

  installPhase = ''
    fontDir="$out/share/fonts/misc"
    install -m 644 -D *.otb out/* -t "$fontDir"
    mkfontdir "$fontDir"
  '';

  meta = with lib; {
    description = "A nice bitmap font, readable even at small sizes";
    longDescription = ''
      Tewi is a bitmap font, readable even at very small font sizes. This is
      particularily useful while programming, to fit a lot of code on your
      screen.
    '';
    homepage = "https://github.com/lucy/tewi-font";
    license = {
      fullName = "GNU General Public License with a font exception";
      url = "https://www.gnu.org/licenses/gpl-faq.html#FontException";
    };
    maintainers = [ maintainers.fro_ozen ];
  };
}