@@ -0,0 +1,40 @@
1+{ lib, stdenv, fetchurl, ocaml, findlib, darwin }:
2+
3+if lib.versionOlder ocaml.version "4.08"
4+then throw "dune 3 is not available for OCaml ${ocaml.version}"
5+else
6+
7+stdenv.mkDerivation rec {
8+ pname = "dune";
9+ version = "3.0.2";
10+
11+ src = fetchurl {
12+ url = "https://github.com/ocaml/dune/releases/download/${version}/fiber-${version}.tbz";
13+ sha256 = "sha256-o108qIeWMOX0VU/wWdc5bg/UDCT2CCcw/Xx3nFiDbes=";
14+ };
15+
16+ nativeBuildInputs = [ ocaml findlib ];
17+
18+ buildInputs = lib.optionals stdenv.isDarwin [
19+ darwin.apple_sdk.frameworks.Foundation
20+ ];
21+
22+ strictDeps = true;
23+
24+ buildFlags = "release";
25+
26+ dontAddPrefix = true;
27+ dontAddStaticConfigureFlags = true;
28+ configurePlatforms = [];
29+
30+ installFlags = [ "PREFIX=${placeholder "out"}" "LIBDIR=$(OCAMLFIND_DESTDIR)" ];
31+
32+ meta = {
33+ homepage = "https://dune.build/";
34+ description = "A composable build system";
35+ changelog = "https://github.com/ocaml/dune/raw/${version}/CHANGES.md";
36+ maintainers = [ lib.maintainers.vbgl lib.maintainers.marsam ];
37+ license = lib.licenses.mit;
38+ inherit (ocaml.meta) platforms;
39+ };
40+}