about summary refs log tree commit diff
path: root/nixpkgs/pkgs/data/fonts/dejavu-fonts/default.nix
blob: 839cb80a6b99c69897c355e6e9a74183027c8cf5 (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
{ fetchFromGitHub, stdenv, fontforge, perl, perlPackages }:

let
  version = "2.37";

  meta = {
    description = "A typeface family based on the Bitstream Vera fonts";
    longDescription = ''
      The DejaVu fonts are TrueType fonts based on the BitStream Vera fonts,
      providing more styles and with greater coverage of Unicode.

      This package includes DejaVu Sans, DejaVu Serif, DejaVu Sans Mono, and
      the TeX Gyre DejaVu Math font.
    '';
    homepage = "http://dejavu-fonts.org/wiki/Main_Page";

    # Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved.
    # Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
    # DejaVu changes are in public domain
    # See http://dejavu-fonts.org/wiki/License for details
    license = stdenv.lib.licenses.free;

    platforms = stdenv.lib.platforms.all;
  };

  full-ttf = stdenv.mkDerivation {
    pname = "dejavu-fonts-full";
    inherit version;
    nativeBuildInputs = [fontforge perl perlPackages.IOString perlPackages.FontTTF];

    src = fetchFromGitHub {
      owner = "dejavu-fonts";
      repo = "dejavu-fonts";
      rev = "version_${stdenv.lib.replaceStrings ["."] ["_"] version}";
      sha256 = "1xknlg2h287dx34v2n5r33bpcl4biqf0cv7nak657rjki7s0k4bk";
    };

    buildFlags = [ "full-ttf" ];

    preBuild = "patchShebangs scripts";

    installPhase = "install -m444 -Dt $out/share/fonts/truetype build/*.ttf";

    inherit meta;
  };

  minimal = stdenv.mkDerivation {
    pname = "dejavu-fonts-minimal";
    inherit version;
    buildCommand = ''
      install -m444 -Dt $out/share/fonts/truetype ${full-ttf}/share/fonts/truetype/DejaVuSans.ttf
    '';
    inherit meta;
  };
in stdenv.mkDerivation {
  pname = "dejavu-fonts";
  inherit version;
  buildCommand = ''
    install -m444 -Dt $out/share/fonts/truetype ${full-ttf}/share/fonts/truetype/*.ttf
    ln -s --relative --force --target-directory=$out/share/fonts/truetype ${minimal}/share/fonts/truetype/DejaVuSans.ttf
  '';
  inherit meta;

  passthru = { inherit minimal full-ttf; };
}