summary refs log tree commit diff
path: root/pkgs/development/tools/ocaml
diff options
context:
space:
mode:
authorJules Aguillon <jules@j3s.fr>2023-04-20 10:55:57 +0200
committerJules Aguillon <jules@j3s.fr>2023-05-05 17:56:28 +0200
commit26775c365901eb099baa798ea0a1e38b6d9d51c9 (patch)
treef87d78c6d2e8aeae80a77e41620d11765de1d577 /pkgs/development/tools/ocaml
parent982a15389b13058eb93e46208d0925f19338b776 (diff)
downloadnixpkgs-26775c365901eb099baa798ea0a1e38b6d9d51c9.tar
nixpkgs-26775c365901eb099baa798ea0a1e38b6d9d51c9.tar.gz
nixpkgs-26775c365901eb099baa798ea0a1e38b6d9d51c9.tar.bz2
nixpkgs-26775c365901eb099baa798ea0a1e38b6d9d51c9.tar.lz
nixpkgs-26775c365901eb099baa798ea0a1e38b6d9d51c9.tar.xz
nixpkgs-26775c365901eb099baa798ea0a1e38b6d9d51c9.tar.zst
nixpkgs-26775c365901eb099baa798ea0a1e38b6d9d51c9.zip
ocamlformat: 0.24.1 -> 0.25.1
The ocamlformat package have been split into two in version 0.25.1:
one for the library and one for the executable.

This adds both packages at the same time.
They have the same sources and very similar dependencies, for which the
definition is shared.
Diffstat (limited to 'pkgs/development/tools/ocaml')
-rw-r--r--pkgs/development/tools/ocaml/ocamlformat/default.nix1
-rw-r--r--pkgs/development/tools/ocaml/ocamlformat/generic.nix61
2 files changed, 14 insertions, 48 deletions
diff --git a/pkgs/development/tools/ocaml/ocamlformat/default.nix b/pkgs/development/tools/ocaml/ocamlformat/default.nix
index f90eaca5273..f0f38777f1c 100644
--- a/pkgs/development/tools/ocaml/ocamlformat/default.nix
+++ b/pkgs/development/tools/ocaml/ocamlformat/default.nix
@@ -12,6 +12,7 @@ rec {
   ocamlformat_0_22_4 = ocamlformat.override { version = "0.22.4"; };
   ocamlformat_0_23_0 = ocamlformat.override { version = "0.23.0"; };
   ocamlformat_0_24_1 = ocamlformat.override { version = "0.24.1"; };
+  ocamlformat_0_25_1 = ocamlformat.override { version = "0.25.1"; };
 
   ocamlformat = callPackage ./generic.nix {};
 }
diff --git a/pkgs/development/tools/ocaml/ocamlformat/generic.nix b/pkgs/development/tools/ocaml/ocamlformat/generic.nix
index 4ed53aad378..0d38d2e0ac0 100644
--- a/pkgs/development/tools/ocaml/ocamlformat/generic.nix
+++ b/pkgs/development/tools/ocaml/ocamlformat/generic.nix
@@ -1,61 +1,26 @@
-{ lib, fetchurl, fetchzip, ocaml-ng
-, version ? "0.24.1"
-, tarballName ? "ocamlformat-${version}.tbz",
-}:
+{ lib, callPackage, ocaml-ng, version ? "0.25.1" }:
 
-let src =
-  fetchurl {
-    url = "https://github.com/ocaml-ppx/ocamlformat/releases/download/${version}/${tarballName}";
-    sha256 = {
-      "0.19.0" = "0ihgwl7d489g938m1jvgx8azdgq9f5np5mzqwwya797hx2m4dz32";
-      "0.20.0" = "sha256-JtmNCgwjbCyUE4bWqdH5Nc2YSit+rekwS43DcviIfgk=";
-      "0.20.1" = "sha256-fTpRZFQW+ngoc0T6A69reEUAZ6GmHkeQvxspd5zRAjU=";
-      "0.21.0" = "sha256-KhgX9rxYH/DM6fCqloe4l7AnJuKrdXSe6Y1XY3BXMy0=";
-      "0.22.4" = "sha256-61TeK4GsfMLmjYGn3ICzkagbc3/Po++Wnqkb2tbJwGA=";
-      "0.23.0" = "sha256-m9Pjz7DaGy917M1GjyfqG5Lm5ne7YSlJF2SVcDHe3+0=";
-      "0.24.0" = "sha256-Zil0wceeXmq2xy0OVLxa/Ujl4Dtsmc4COyv6Jo7rVaM=";
-      "0.24.1" = "sha256-AjQl6YGPgOpQU3sjcaSnZsFJqZV9BYB+iKAE0tX0Qc4=";
-    }."${version}";
-  };
-  ocamlPackages = ocaml-ng.ocamlPackages;
-in
+with ocaml-ng.ocamlPackages;
 
-with ocamlPackages;
+let
+  inherit (callPackage ../../../ocaml-modules/ocamlformat/generic.nix {
+    inherit version;
+  })
+    src library_deps;
 
-buildDunePackage {
+in buildDunePackage {
   pname = "ocamlformat";
   inherit src version;
 
   minimalOCamlVersion = "4.08";
   duneVersion = "3";
 
-  nativeBuildInputs = [
-    menhir
-  ];
+  nativeBuildInputs =
+    if lib.versionAtLeast version "0.25.1" then [ ] else [ menhir ];
 
-  buildInputs = [
-    base
-    dune-build-info
-    fix
-    fpath
-    menhirLib
-    menhirSdk
-    ocp-indent
-    re
-    stdio
-    uuseg
-    uutf
-  ]
-  ++ lib.optionals (lib.versionAtLeast version "0.20.0") [ ocaml-version either ]
-  ++ (if lib.versionAtLeast version "0.24.0"
-      then [ (odoc-parser.override { version = "2.0.0"; }) ]
-      else if lib.versionAtLeast version "0.20.1"
-      then [ (odoc-parser.override { version = "1.0.1"; }) ]
-      else [ (odoc-parser.override { version = "0.9.0"; }) ])
-  ++ (if lib.versionAtLeast version "0.21.0"
-      then [ cmdliner_1_1 ]
-      else [ cmdliner_1_0 ])
-  ++ lib.optionals (lib.versionAtLeast version "0.22.4") [ csexp ];
+  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";