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 { lib, fetchFromGitHub, buildDunePackage, ocaml
, version ? "0.8.1" , legacy ? false
, ocaml-compiler-libs, ocaml-migrate-parsetree, ppx_derivers, stdio , ocaml-compiler-libs, ocaml-migrate-parsetree, ppx_derivers, stdio
}: }:
let sha256 = let param =
{ "0.8.1" = "0vm0jajmg8135scbg0x60ivyy5gzv4abwnl7zls2mrw23ac6kml6"; if legacy then {
"0.12.0" = "1cg0is23c05k1rc94zcdz452p9zn11dpqxm1pnifwx5iygz3w0a1"; version = "0.8.1";
}."${version}" sha256 = "0vm0jajmg8135scbg0x60ivyy5gzv4abwnl7zls2mrw23ac6kml6";
; in } 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 { buildDunePackage rec {
pname = "ppxlib"; pname = "ppxlib";
inherit version; inherit (param) version;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ocaml-ppx"; owner = "ocaml-ppx";
repo = pname; repo = pname;
rev = version; rev = version;
inherit sha256; inherit (param) sha256;
}; };
propagatedBuildInputs = [ propagatedBuildInputs = [
@ -26,8 +33,8 @@ buildDunePackage rec {
meta = { meta = {
description = "Comprehensive ppx tool set"; description = "Comprehensive ppx tool set";
license = stdenv.lib.licenses.mit; license = lib.licenses.mit;
maintainers = [ stdenv.lib.maintainers.vbgl ]; maintainers = [ lib.maintainers.vbgl ];
inherit (src.meta) homepage; 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 = 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 { 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-tyxml = callPackage ../development/tools/ocaml/js_of_ocaml/tyxml.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_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 {}; ppx_deriving_yojson = callPackage ../development/ocaml-modules/ppx_deriving_yojson {};
@ -824,7 +824,6 @@ let
ppx_import = callPackage ../development/ocaml-modules/ppx_import {}; ppx_import = callPackage ../development/ocaml-modules/ppx_import {};
ppx_irmin = callPackage ../development/ocaml-modules/irmin/ppx.nix { 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 {}; ppx_sqlexpr = callPackage ../development/ocaml-modules/sqlexpr/ppx.nix {};
@ -965,20 +964,21 @@ let
janeStreet = janeStreet =
if lib.versionOlder "4.08" ocaml.version if lib.versionOlder "4.08" ocaml.version
then import ../development/ocaml-modules/janestreet/0.13.nix { 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; inherit (pkgs) openssl;
ppxlib = ppxlib.override { version = "0.12.0"; };
} }
else if lib.versionOlder "4.07" ocaml.version else if lib.versionOlder "4.07" ocaml.version
then import ../development/ocaml-modules/janestreet/0.12.nix { 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; inherit (pkgs) openssl;
ppxlib = ppxlib.override { legacy = true; };
} }
else import ../development/ocaml-modules/janestreet { else import ../development/ocaml-modules/janestreet {
inherit janePackage ocamlbuild angstrom ctypes cryptokit; inherit janePackage ocamlbuild angstrom ctypes cryptokit;
inherit magic-mime num ocaml-migrate-parsetree octavius ounit; inherit magic-mime num ocaml-migrate-parsetree octavius ounit;
inherit ppx_deriving re ppxlib; inherit ppx_deriving re;
inherit (pkgs) openssl; inherit (pkgs) openssl;
ppxlib = ppxlib.override { legacy = true; };
}; };
janeStreet_0_9_0 = import ../development/ocaml-modules/janestreet/old.nix { janeStreet_0_9_0 = import ../development/ocaml-modules/janestreet/old.nix {