2023-09-26 14:28:44 +00:00
|
|
|
# Version can be selected with the 'version' argument, see generic.nix.
|
2023-08-07 15:08:52 +00:00
|
|
|
{ lib
|
|
|
|
, callPackage
|
|
|
|
, buildDunePackage
|
2023-08-17 19:06:19 +00:00
|
|
|
, ocaml
|
2023-08-07 15:08:52 +00:00
|
|
|
, re
|
|
|
|
, ocamlformat-lib
|
|
|
|
, menhir
|
2023-09-26 14:28:44 +00:00
|
|
|
, ...
|
|
|
|
}@args:
|
2020-12-08 20:50:10 +00:00
|
|
|
|
2023-09-26 14:28:44 +00:00
|
|
|
let inherit (callPackage ./generic.nix args) src version library_deps;
|
2023-08-17 19:06:19 +00:00
|
|
|
in
|
2020-10-14 14:19:25 +00:00
|
|
|
|
2023-08-17 19:06:19 +00:00
|
|
|
lib.throwIf (lib.versionAtLeast ocaml.version "5.0" && !lib.versionAtLeast version "0.23")
|
|
|
|
"ocamlformat ${version} is not available for OCaml ${ocaml.version}"
|
|
|
|
|
|
|
|
buildDunePackage {
|
2020-10-14 14:19:25 +00:00
|
|
|
pname = "ocamlformat";
|
|
|
|
inherit src version;
|
|
|
|
|
2023-03-29 04:31:56 +00:00
|
|
|
minimalOCamlVersion = "4.08";
|
2022-02-22 09:59:04 +00:00
|
|
|
|
2023-04-20 08:55:57 +00:00
|
|
|
nativeBuildInputs =
|
|
|
|
if lib.versionAtLeast version "0.25.1" then [ ] else [ menhir ];
|
2022-02-22 09:59:04 +00:00
|
|
|
|
2023-04-20 08:55:57 +00:00
|
|
|
buildInputs = [ re ] ++ library_deps
|
|
|
|
++ lib.optionals (lib.versionAtLeast version "0.25.1")
|
|
|
|
[ (ocamlformat-lib.override { inherit version; }) ];
|
2020-10-14 14:19:25 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://github.com/ocaml-ppx/ocamlformat";
|
|
|
|
description = "Auto-formatter for OCaml code";
|
2024-04-24 04:20:00 +00:00
|
|
|
maintainers = with lib.maintainers; [ Zimmi48 Julow ];
|
2020-10-14 14:19:25 +00:00
|
|
|
license = lib.licenses.mit;
|
2023-08-07 15:08:52 +00:00
|
|
|
mainProgram = "ocamlformat";
|
2020-10-14 14:19:25 +00:00
|
|
|
};
|
|
|
|
}
|