1{ lib, stdenvNoCC, fetchzip, texlive, callPackage }:
2
3stdenvNoCC.mkDerivation rec {
4 pname = "junicode";
5 version = "2.208";
6
7 src = fetchzip {
8 url = "https://github.com/psb1558/Junicode-font/releases/download/v${version}/Junicode_${version}.zip";
9 hash = "sha256-uzPzZ6b/CxdcoXSsxf2Cfs9/MpcGn7pQfdwL37pbvXg=";
10 };
11
12 outputs = [ "out" "doc" "tex" ];
13
14 patches = [ ./tex-font-path.patch ];
15
16 postPatch = ''
17 substituteInPlace TeX/junicode.sty \
18 --replace '@@@opentype_path@@@' "$out/share/fonts/opentype/" \
19 --replace '@@@truetype_path@@@' "$out/share/fonts/truetype/"
20 substituteInPlace TeX/junicodevf.sty \
21 --replace '@@@truetype_path@@@' "$out/share/fonts/truetype/"
22 '';
23
24 installPhase = ''
25 runHook preInstall
26
27 install -Dm 444 -t $out/share/fonts/truetype TTF/*.ttf VAR/*.ttf
28 install -Dm 444 -t $out/share/fonts/opentype OTF/*.otf
29 install -Dm 444 -t $out/share/fonts/woff2 WOFF2/*.woff2
30
31 install -Dm 444 -t $doc/share/doc/${pname}-${version} docs/*.pdf
32
33 install -Dm 444 -t $tex/tex/latex/junicode TeX/junicode.sty
34 install -Dm 444 -t $tex/tex/latex/junicodevf TeX/junicodevf.{sty,lua}
35
36 runHook postInstall
37 '';
38
39 passthru = {
40 tlDeps = with texlive; [ xkeyval fontspec ];
41
42 tests = callPackage ./tests.nix { };
43 };
44
45 meta = {
46 homepage = "https://github.com/psb1558/Junicode-font";
47 description = "Unicode font for medievalists";
48 maintainers = with lib.maintainers; [ ivan-timokhin ];
49 license = lib.licenses.ofl;
50 };
51}