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