buildDunePackage: new support function; use it to refactor some OCaml derivations
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
{ stdenv, fetchurl, ocaml, dune, findlib, sexplib, ocplib-endian }:
|
||||
{ stdenv, fetchurl, buildDunePackage, sexplib, ocplib-endian }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "ocaml${ocaml.version}-cstruct-${version}";
|
||||
buildDunePackage rec {
|
||||
pname = "cstruct";
|
||||
version = "3.1.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/mirage/ocaml-cstruct/releases/download/v${version}/cstruct-${version}.tbz";
|
||||
sha256 = "1x4jxsvd1lrfibnjdjrkfl7hqsc48rljnwbap6faanj9qhwwa6v2";
|
||||
@@ -10,19 +11,12 @@ stdenv.mkDerivation rec {
|
||||
|
||||
unpackCmd = "tar -xjf $curSrc";
|
||||
|
||||
buildInputs = [ ocaml dune findlib ];
|
||||
|
||||
propagatedBuildInputs = [ sexplib ocplib-endian ];
|
||||
|
||||
buildPhase = "dune build -p cstruct";
|
||||
|
||||
inherit (dune) installPhase;
|
||||
|
||||
meta = {
|
||||
description = "Access C-like structures directly from OCaml";
|
||||
license = stdenv.lib.licenses.isc;
|
||||
homepage = "https://github.com/mirage/ocaml-cstruct";
|
||||
maintainers = [ stdenv.lib.maintainers.vbgl ];
|
||||
inherit (ocaml.meta) platforms;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
{ stdenv, ocaml, cstruct, lwt }:
|
||||
{ buildDunePackage, cstruct, lwt }:
|
||||
|
||||
assert stdenv.lib.versionAtLeast ocaml.version "4.02";
|
||||
buildDunePackage {
|
||||
pname = "cstruct-lwt";
|
||||
inherit (cstruct) version src unpackCmd meta;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "ocaml${ocaml.version}-cstruct-lwt-${version}";
|
||||
inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
|
||||
minimumOCamlVersion = "4.02";
|
||||
|
||||
propagatedBuildInputs = [ cstruct lwt ];
|
||||
|
||||
buildPhase = "${cstruct.buildPhase}-lwt";
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
{ stdenv, ocaml, cstruct, ppx_tools_versioned }:
|
||||
{ buildDunePackage, cstruct, ppx_tools_versioned }:
|
||||
|
||||
assert stdenv.lib.versionAtLeast ocaml.version "4.02";
|
||||
buildDunePackage {
|
||||
pname = "ppx_cstruct";
|
||||
inherit (cstruct) version src unpackCmd meta;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "ocaml${ocaml.version}-ppx_cstruct-${version}";
|
||||
inherit (cstruct) version src unpackCmd installPhase meta;
|
||||
minimumOCamlVersion = "4.02";
|
||||
|
||||
buildInputs = cstruct.buildInputs ++ [ ppx_tools_versioned ];
|
||||
buildInputs = [ ppx_tools_versioned ];
|
||||
propagatedBuildInputs = [ cstruct ];
|
||||
|
||||
buildPhase = "dune build -p ppx_cstruct";
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
{ stdenv, ocaml, cstruct }:
|
||||
{ buildDunePackage, cstruct }:
|
||||
|
||||
assert stdenv.lib.versionAtLeast ocaml.version "4.02";
|
||||
buildDunePackage {
|
||||
pname = "cstruct-unix";
|
||||
inherit (cstruct) version src unpackCmd meta;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "ocaml${ocaml.version}-cstruct-unix-${version}";
|
||||
inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
|
||||
minimumOCamlVersion = "4.02";
|
||||
|
||||
propagatedBuildInputs = [ cstruct ];
|
||||
|
||||
buildPhase = "${cstruct.buildPhase}-unix";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user