buildDunePackage: new support function; use it to refactor some OCaml derivations
This commit is contained in:
@@ -1,35 +1,29 @@
|
||||
{ stdenv, fetchzip, pkgconfig, ncurses, libev, dune
|
||||
, ocaml, findlib, cppo
|
||||
, ocaml-migrate-parsetree, ppx_tools_versioned, result
|
||||
{ stdenv, fetchzip, pkgconfig, ncurses, libev, buildDunePackage, ocaml
|
||||
, cppo, ocaml-migrate-parsetree, ppx_tools_versioned, result
|
||||
}:
|
||||
|
||||
let inherit (stdenv.lib) optional versionAtLeast; in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
buildDunePackage rec {
|
||||
pname = "lwt";
|
||||
version = "4.1.0";
|
||||
name = "ocaml${ocaml.version}-lwt-${version}";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://github.com/ocsigen/lwt/archive/${version}.tar.gz";
|
||||
url = "https://github.com/ocsigen/${pname}/archive/${version}.tar.gz";
|
||||
sha256 = "16wnc61kfj54z4q8sn9f5iik37pswz328hcz3z6rkza3kh3s6wmm";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [ ocaml findlib dune cppo
|
||||
ocaml-migrate-parsetree ppx_tools_versioned
|
||||
] ++ optional (!versionAtLeast ocaml.version "4.07") ncurses;
|
||||
buildInputs = [ cppo ocaml-migrate-parsetree ppx_tools_versioned ]
|
||||
++ optional (!versionAtLeast ocaml.version "4.07") ncurses;
|
||||
propagatedBuildInputs = [ libev result ];
|
||||
|
||||
configurePhase = "ocaml src/util/configure.ml -use-libev true";
|
||||
buildPhase = "jbuilder build -p lwt";
|
||||
inherit (dune) installPhase;
|
||||
|
||||
meta = {
|
||||
homepage = "https://ocsigen.org/lwt/";
|
||||
description = "A cooperative threads library for OCaml";
|
||||
maintainers = [ stdenv.lib.maintainers.vbgl ];
|
||||
license = stdenv.lib.licenses.lgpl21;
|
||||
inherit (ocaml.meta) platforms;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
{ stdenv, dune, ocaml, findlib, lwt, ppx_tools_versioned }:
|
||||
{ stdenv, buildDunePackage, lwt, ppx_tools_versioned }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "ocaml${ocaml.version}-lwt_ppx-${lwt.version}";
|
||||
buildDunePackage {
|
||||
pname = "lwt_ppx";
|
||||
|
||||
inherit (lwt) src;
|
||||
|
||||
buildInputs = [ dune ocaml findlib ppx_tools_versioned ];
|
||||
inherit (lwt) src version;
|
||||
|
||||
buildInputs = [ ppx_tools_versioned ];
|
||||
propagatedBuildInputs = [ lwt ];
|
||||
|
||||
buildPhase = "dune build -p lwt_ppx";
|
||||
installPhase = "${dune.installPhase} lwt_ppx.install";
|
||||
|
||||
meta = {
|
||||
description = "Ppx syntax extension for Lwt";
|
||||
inherit (lwt.meta) license platforms homepage maintainers;
|
||||
inherit (lwt.meta) license homepage maintainers;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user