1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 20:21:14 +00:00

ocamlPackages.ppxlib: minor refactoring

This commit is contained in:
Vincent Laporte 2020-05-12 21:14:39 +02:00 committed by Vincent Laporte
parent f31adf28b7
commit 4a873aa29e
2 changed files with 27 additions and 20 deletions

View file

@ -1,23 +1,30 @@
{ stdenv, fetchFromGitHub, buildDunePackage
, version ? "0.8.1"
{ lib, fetchFromGitHub, buildDunePackage, ocaml
, legacy ? false
, ocaml-compiler-libs, ocaml-migrate-parsetree, ppx_derivers, stdio
}:
let sha256 =
{ "0.8.1" = "0vm0jajmg8135scbg0x60ivyy5gzv4abwnl7zls2mrw23ac6kml6";
"0.12.0" = "1cg0is23c05k1rc94zcdz452p9zn11dpqxm1pnifwx5iygz3w0a1";
}."${version}"
; in
let param =
if legacy then {
version = "0.8.1";
sha256 = "0vm0jajmg8135scbg0x60ivyy5gzv4abwnl7zls2mrw23ac6kml6";
} else {
version = "0.12.0";
sha256 = "1cg0is23c05k1rc94zcdz452p9zn11dpqxm1pnifwx5iygz3w0a1";
}; in
if lib.versionAtLeast ocaml.version "4.10" && legacy
then throw "ppxlib-${param.version} is not available for OCaml ${ocaml.version}"
else
buildDunePackage rec {
pname = "ppxlib";
inherit version;
inherit (param) version;
src = fetchFromGitHub {
owner = "ocaml-ppx";
repo = pname;
rev = version;
inherit sha256;
inherit (param) sha256;
};
propagatedBuildInputs = [
@ -26,8 +33,8 @@ buildDunePackage rec {
meta = {
description = "Comprehensive ppx tool set";
license = stdenv.lib.licenses.mit;
maintainers = [ stdenv.lib.maintainers.vbgl ];
license = lib.licenses.mit;
maintainers = [ lib.maintainers.vbgl ];
inherit (src.meta) homepage;
};
}

View file

@ -413,9 +413,7 @@ let
js_of_ocaml-ppx = callPackage ../development/tools/ocaml/js_of_ocaml/ppx.nix {};
js_of_ocaml-ppx_deriving_json = callPackage ../development/tools/ocaml/js_of_ocaml/ppx_deriving_json.nix {
ppxlib = ppxlib.override { version = "0.12.0"; };
};
js_of_ocaml-ppx_deriving_json = callPackage ../development/tools/ocaml/js_of_ocaml/ppx_deriving_json.nix { };
js_of_ocaml-tyxml = callPackage ../development/tools/ocaml/js_of_ocaml/tyxml.nix {};
@ -815,7 +813,9 @@ let
ppx_deriving_protobuf = callPackage ../development/ocaml-modules/ppx_deriving_protobuf {};
ppx_deriving_rpc = callPackage ../development/ocaml-modules/ppx_deriving_rpc {};
ppx_deriving_rpc = callPackage ../development/ocaml-modules/ppx_deriving_rpc {
ppxlib = ppxlib.override { legacy = true; };
};
ppx_deriving_yojson = callPackage ../development/ocaml-modules/ppx_deriving_yojson {};
@ -824,7 +824,6 @@ let
ppx_import = callPackage ../development/ocaml-modules/ppx_import {};
ppx_irmin = callPackage ../development/ocaml-modules/irmin/ppx.nix {
ppxlib = ppxlib.override { version = "0.12.0"; };
};
ppx_sqlexpr = callPackage ../development/ocaml-modules/sqlexpr/ppx.nix {};
@ -965,20 +964,21 @@ let
janeStreet =
if lib.versionOlder "4.08" ocaml.version
then import ../development/ocaml-modules/janestreet/0.13.nix {
inherit ctypes janePackage num octavius re;
inherit ctypes janePackage num octavius ppxlib re;
inherit (pkgs) openssl;
ppxlib = ppxlib.override { version = "0.12.0"; };
}
else if lib.versionOlder "4.07" ocaml.version
then import ../development/ocaml-modules/janestreet/0.12.nix {
inherit ctypes janePackage num octavius ppxlib re;
inherit ctypes janePackage num octavius re;
inherit (pkgs) openssl;
ppxlib = ppxlib.override { legacy = true; };
}
else import ../development/ocaml-modules/janestreet {
inherit janePackage ocamlbuild angstrom ctypes cryptokit;
inherit magic-mime num ocaml-migrate-parsetree octavius ounit;
inherit ppx_deriving re ppxlib;
inherit ppx_deriving re;
inherit (pkgs) openssl;
ppxlib = ppxlib.override { legacy = true; };
};
janeStreet_0_9_0 = import ../development/ocaml-modules/janestreet/old.nix {