Merge: zmap: 4.2.0 -> 4.3.1 (#364578)
[NixPkgs.git] / pkgs / tools / typesetting / satysfi / default.nix
blobcfc6ef704b03b3a3555c91d354c32f30a8945eee
2   lib,
3   fetchFromGitHub,
4   ocamlPackages,
5   ipaexfont,
6   junicode,
7   lmodern,
8   lmmath,
9 }:
10 let
11   camlpdf = ocamlPackages.camlpdf.overrideAttrs {
12     src = fetchFromGitHub {
13       owner = "gfngfn";
14       repo = "camlpdf";
15       rev = "v2.3.1+satysfi";
16       sha256 = "1s8wcqdkl1alvfcj67lhn3qdz8ikvd1v64f4q6bi4c0qj9lmp30k";
17     };
18   };
19   yojson-with-position = ocamlPackages.buildDunePackage {
20     pname = "yojson-with-position";
21     version = "1.4.2";
22     src = fetchFromGitHub {
23       owner = "gfngfn";
24       repo = "yojson-with-position";
25       rev = "v1.4.2+satysfi";
26       sha256 = "17s5xrnpim54d1apy972b5l08bph4c0m5kzbndk600fl0vnlirnl";
27     };
28     nativeBuildInputs = [ ocamlPackages.cppo ];
29     propagatedBuildInputs = [ ocamlPackages.biniou ];
30     inherit (ocamlPackages.yojson) meta;
31   };
33 ocamlPackages.buildDunePackage rec {
34   pname = "satysfi";
35   version = "0.0.10";
36   src = fetchFromGitHub {
37     owner = "gfngfn";
38     repo = "SATySFi";
39     rev = "v${version}";
40     hash = "sha256-qgVM7ExsKtzNQkZO+I+rcWLj4LSvKL5uyitH7Jg+ns0=";
41     fetchSubmodules = true;
42   };
44   preConfigure = ''
45     substituteInPlace src/frontend/main.ml --replace \
46     '/usr/local/share/satysfi"; "/usr/share/satysfi' \
47     $out/share/satysfi
48   '';
50   nativeBuildInputs = with ocamlPackages; [
51     menhir
52     cppo
53   ];
55   buildInputs =
56     [
57       camlpdf
58       yojson-with-position
59     ]
60     ++ (with ocamlPackages; [
61       menhirLib
62       batteries
63       camlimages
64       core_kernel
65       ppx_deriving
66       uutf
67       omd
68       re
69       otfed
70     ]);
72   postInstall = ''
73     mkdir -p $out/share/satysfi/dist/fonts
74     cp -r lib-satysfi/dist/ $out/share/satysfi/
75     cp -r \
76       ${ipaexfont}/share/fonts/opentype/* \
77       ${lmodern}/share/fonts/opentype/public/lm/* \
78       ${lmmath}/share/fonts/opentype/latinmodern-math.otf \
79       ${junicode}/share/fonts/truetype/Junicode-{Bold,BoldItalic,Italic}.ttf \
80       $out/share/satysfi/dist/fonts/
81     cp ${junicode}/share/fonts/truetype/Junicode-Regular.ttf \
82       $out/share/satysfi/dist/fonts/Junicode.ttf
83   '';
85   meta = with lib; {
86     homepage = "https://github.com/gfngfn/SATySFi";
87     description = "Statically-typed, functional typesetting system";
88     changelog = "https://github.com/gfngfn/SATySFi/blob/v${version}/CHANGELOG.md";
89     license = licenses.lgpl3Only;
90     maintainers = [ maintainers.mt-caret ];
91     platforms = platforms.all;
92     mainProgram = "satysfi";
93   };