lol
1{ lib, fetchurl, version ? "0.26.2", astring, base, camlp-streams, cmdliner_1_0
2, cmdliner_1_1, csexp, dune-build-info, either, fix, fpath, menhirLib, menhirSdk
3, ocaml-version, ocp-indent, odoc-parser, result, stdio, uuseg, uutf, ... }:
4
5# The ocamlformat package have been split into two in version 0.25.1:
6# one for the library and one for the executable.
7# Both have the same sources and very similar dependencies.
8
9rec {
10 tarballName = "ocamlformat-${version}.tbz";
11
12 src = fetchurl {
13 url =
14 "https://github.com/ocaml-ppx/ocamlformat/releases/download/${version}/${tarballName}";
15 sha256 = {
16 "0.19.0" = "0ihgwl7d489g938m1jvgx8azdgq9f5np5mzqwwya797hx2m4dz32";
17 "0.20.0" = "sha256-JtmNCgwjbCyUE4bWqdH5Nc2YSit+rekwS43DcviIfgk=";
18 "0.20.1" = "sha256-fTpRZFQW+ngoc0T6A69reEUAZ6GmHkeQvxspd5zRAjU=";
19 "0.21.0" = "sha256-KhgX9rxYH/DM6fCqloe4l7AnJuKrdXSe6Y1XY3BXMy0=";
20 "0.22.4" = "sha256-61TeK4GsfMLmjYGn3ICzkagbc3/Po++Wnqkb2tbJwGA=";
21 "0.23.0" = "sha256-m9Pjz7DaGy917M1GjyfqG5Lm5ne7YSlJF2SVcDHe3+0=";
22 "0.24.0" = "sha256-Zil0wceeXmq2xy0OVLxa/Ujl4Dtsmc4COyv6Jo7rVaM=";
23 "0.24.1" = "sha256-AjQl6YGPgOpQU3sjcaSnZsFJqZV9BYB+iKAE0tX0Qc4=";
24 "0.25.1" = "sha256-3I8qMwyjkws2yssmI7s2Dti99uSorNKT29niJBpv0z0=";
25 "0.26.0" = "sha256-AxSUq3cM7xCo9qocvrVmDkbDqmwM1FexEP7IWadeh30=";
26 "0.26.1" = "sha256-2gBuQn8VuexhL7gI1EZZm9m3w+4lq+s9VVdHpw10xtc=";
27 "0.26.2" = "sha256-Lk9Za/eqNnqET+g7oPawvxSyplF53cCCNj/peT0DdcU=";
28 }."${version}";
29 };
30
31 inherit version;
32
33 odoc-parser_v = odoc-parser.override {
34 version = if lib.versionAtLeast version "0.24.0" then
35 "2.0.0"
36 else if lib.versionAtLeast version "0.20.1" then
37 "1.0.1"
38 else
39 "0.9.0";
40 };
41
42 cmdliner_v =
43 if lib.versionAtLeast version "0.21.0" then cmdliner_1_1 else cmdliner_1_0;
44
45 library_deps = [
46 base
47 cmdliner_v
48 dune-build-info
49 fix
50 fpath
51 menhirLib
52 menhirSdk
53 ocp-indent
54 stdio
55 uuseg
56 uutf
57 ] ++ lib.optionals (lib.versionAtLeast version "0.20.0") [
58 either
59 ocaml-version
60 ] ++ lib.optionals (lib.versionAtLeast version "0.22.4") [ csexp ]
61 ++ (if lib.versionOlder version "0.25.1" then
62 [ odoc-parser_v ]
63 else [
64 camlp-streams
65 result
66 astring
67 ]);
68}