lol
1# Version can be selected with the 'version' argument, see generic.nix.
2{
3 lib,
4 callPackage,
5 buildDunePackage,
6 ocaml,
7 re,
8 ocamlformat-lib,
9 menhir,
10 ...
11}@args:
12
13let
14 inherit (callPackage ./generic.nix args) src version library_deps;
15in
16
17lib.throwIf
18 (
19 lib.versionAtLeast ocaml.version "5.0" && !lib.versionAtLeast version "0.23"
20 || lib.versionAtLeast ocaml.version "5.2" && !lib.versionAtLeast version "0.26.2"
21 || lib.versionAtLeast ocaml.version "5.3" && !lib.versionAtLeast version "0.27"
22 )
23 "ocamlformat ${version} is not available for OCaml ${ocaml.version}"
24
25 buildDunePackage
26 {
27 pname = "ocamlformat";
28 inherit src version;
29
30 minimalOCamlVersion = "4.08";
31
32 nativeBuildInputs = if lib.versionAtLeast version "0.25.1" then [ ] else [ menhir ];
33
34 buildInputs =
35 [ re ]
36 ++ library_deps
37 ++ lib.optionals (lib.versionAtLeast version "0.25.1") [
38 (ocamlformat-lib.override { inherit version; })
39 ];
40
41 meta = {
42 homepage = "https://github.com/ocaml-ppx/ocamlformat";
43 description = "Auto-formatter for OCaml code";
44 maintainers = with lib.maintainers; [
45 Zimmi48
46 Julow
47 ];
48 license = lib.licenses.mit;
49 mainProgram = "ocamlformat";
50 };
51 }