about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/ocamlformat/ocamlformat.nix
diff options
context:
space:
mode:
authorJules Aguillon <jules@j3s.fr>2023-07-05 17:21:04 +0200
committerJules Aguillon <jules@j3s.fr>2023-07-05 17:21:04 +0200
commitfb98ebb9a05fefa25585ef78000b40744e8d4d17 (patch)
tree9faabf43a7841383cf9ecab3a90e319bd93462bd /pkgs/development/ocaml-modules/ocamlformat/ocamlformat.nix
parenta5ca6a0f2ee8b2c8aa2cca64a06bd5652ad28a4b (diff)
ocamlPackages.ocamlformat: Move into 'ocamlPackages'
Move the definitions of OCamlformat packages into ocamlPackages. This
moves the package containing the tool closer to the definition of the
library.

It's now possible to build OCamlformat using a different version of
OCaml than the default.

`ocamlformat`, `ocamlPackages.ocamlformat` and
`ocaml-ng.ocamlPackages_<lastest>.ocamlformat` are all aliases.
Diffstat (limited to 'pkgs/development/ocaml-modules/ocamlformat/ocamlformat.nix')
-rw-r--r--pkgs/development/ocaml-modules/ocamlformat/ocamlformat.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/pkgs/development/ocaml-modules/ocamlformat/ocamlformat.nix b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat.nix
new file mode 100644
index 0000000000000..30a0b01e5af46
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat.nix
@@ -0,0 +1,27 @@
+{ lib, callPackage, ocaml-ng, version ? "0.25.1" }:
+
+with ocaml-ng.ocamlPackages;
+
+let inherit (callPackage ./generic.nix { inherit version; }) src library_deps;
+
+in buildDunePackage {
+  pname = "ocamlformat";
+  inherit src version;
+
+  minimalOCamlVersion = "4.08";
+  duneVersion = "3";
+
+  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;
+  };
+}