about summary refs log tree commit diff
path: root/nixpkgs/pkgs/data/fonts/junicode/default.nix
blob: 1bc12ad70abbd65281c6da8bf259a7ccfd8b41a4 (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
{ lib, stdenvNoCC, fetchzip, texlive, callPackage }:

stdenvNoCC.mkDerivation rec {
  pname = "junicode";
  version = "2.206";

  src = fetchzip {
    url = "https://github.com/psb1558/Junicode-font/releases/download/v${version}/Junicode_${version}.zip";
    hash = "sha256-oOKg85Yz5/2/pvwjVqeQXE8xE7X+QJvPYwYN+E18oEc=";
  };

  outputs = [ "out" "doc" "tex" ];

  patches = [ ./tex-font-path.patch ];

  postPatch = ''
    substituteInPlace TeX/junicode.sty \
      --replace '@@@opentype_path@@@' "$out/share/fonts/opentype/" \
      --replace '@@@truetype_path@@@' "$out/share/fonts/truetype/"
    substituteInPlace TeX/junicodevf.sty \
      --replace '@@@truetype_path@@@' "$out/share/fonts/truetype/"
  '';

  installPhase = ''
    runHook preInstall

    install -Dm 444 -t $out/share/fonts/truetype TTF/*.ttf VAR/*.ttf
    install -Dm 444 -t $out/share/fonts/opentype OTF/*.otf
    install -Dm 444 -t $out/share/fonts/woff2 WOFF2/*.woff2

    install -Dm 444 -t $doc/share/doc/${pname}-${version} docs/*.pdf

    install -Dm 444 -t $tex/tex/latex/junicode TeX/junicode.sty
    install -Dm 444 -t $tex/tex/latex/junicodevf TeX/junicodevf.{sty,lua}

    runHook postInstall
  '';

  passthru = {
    tlDeps = with texlive; [ xkeyval fontspec ];

    tests = callPackage ./tests.nix { };
  };

  meta = {
    homepage = "https://github.com/psb1558/Junicode-font";
    description = "A Unicode font for medievalists";
    maintainers = with lib.maintainers; [ ivan-timokhin ];
    license = lib.licenses.ofl;
  };
}