nixpkgs/pkgs/development/ocaml-modules/ocamlformat/ocamlformat.nix
Jules Aguillon 32a2a0852c Link version for ocamlformat{,-lib,-rpc-lib}
The default (latest) version is now defined in 'generic.nix' and is the
same for the three packages.

'ocamlformat-rpc-lib' is no longer defined separately and also use the
latest version as a default.
2023-09-26 16:28:44 +02:00

38 lines
1,012 B
Nix

# Version can be selected with the 'version' argument, see generic.nix.
{ lib
, callPackage
, buildDunePackage
, ocaml
, re
, ocamlformat-lib
, menhir
, ...
}@args:
let inherit (callPackage ./generic.nix args) src version library_deps;
in
lib.throwIf (lib.versionAtLeast ocaml.version "5.0" && !lib.versionAtLeast version "0.23")
"ocamlformat ${version} is not available for OCaml ${ocaml.version}"
buildDunePackage {
pname = "ocamlformat";
inherit src version;
minimalOCamlVersion = "4.08";
nativeBuildInputs =
if lib.versionAtLeast version "0.25.1" then [ ] else [ menhir ];
buildInputs = [ re ] ++ library_deps
++ lib.optionals (lib.versionAtLeast version "0.25.1")
[ (ocamlformat-lib.override { inherit version; }) ];
meta = {
homepage = "https://github.com/ocaml-ppx/ocamlformat";
description = "Auto-formatter for OCaml code";
maintainers = with lib.maintainers; [ Zimmi48 marsam Julow ];
license = lib.licenses.mit;
mainProgram = "ocamlformat";
};
}