ocamlPackages.ppxlib: minor refactoring

authored by Vincent Laporte and committed by Vincent Laporte 4a873aa2 f31adf28

+27 -20
+18 -11
pkgs/development/ocaml-modules/ppxlib/default.nix
··· 1 - { stdenv, fetchFromGitHub, buildDunePackage 2 - , version ? "0.8.1" 3 , ocaml-compiler-libs, ocaml-migrate-parsetree, ppx_derivers, stdio 4 }: 5 6 - let sha256 = 7 - { "0.8.1" = "0vm0jajmg8135scbg0x60ivyy5gzv4abwnl7zls2mrw23ac6kml6"; 8 - "0.12.0" = "1cg0is23c05k1rc94zcdz452p9zn11dpqxm1pnifwx5iygz3w0a1"; 9 - }."${version}" 10 - ; in 11 12 buildDunePackage rec { 13 pname = "ppxlib"; 14 - inherit version; 15 16 src = fetchFromGitHub { 17 owner = "ocaml-ppx"; 18 repo = pname; 19 rev = version; 20 - inherit sha256; 21 }; 22 23 propagatedBuildInputs = [ ··· 26 27 meta = { 28 description = "Comprehensive ppx tool set"; 29 - license = stdenv.lib.licenses.mit; 30 - maintainers = [ stdenv.lib.maintainers.vbgl ]; 31 inherit (src.meta) homepage; 32 }; 33 }
··· 1 + { lib, fetchFromGitHub, buildDunePackage, ocaml 2 + , legacy ? false 3 , ocaml-compiler-libs, ocaml-migrate-parsetree, ppx_derivers, stdio 4 }: 5 6 + let param = 7 + if legacy then { 8 + version = "0.8.1"; 9 + sha256 = "0vm0jajmg8135scbg0x60ivyy5gzv4abwnl7zls2mrw23ac6kml6"; 10 + } else { 11 + version = "0.12.0"; 12 + sha256 = "1cg0is23c05k1rc94zcdz452p9zn11dpqxm1pnifwx5iygz3w0a1"; 13 + }; in 14 + 15 + if lib.versionAtLeast ocaml.version "4.10" && legacy 16 + then throw "ppxlib-${param.version} is not available for OCaml ${ocaml.version}" 17 + else 18 19 buildDunePackage rec { 20 pname = "ppxlib"; 21 + inherit (param) version; 22 23 src = fetchFromGitHub { 24 owner = "ocaml-ppx"; 25 repo = pname; 26 rev = version; 27 + inherit (param) sha256; 28 }; 29 30 propagatedBuildInputs = [ ··· 33 34 meta = { 35 description = "Comprehensive ppx tool set"; 36 + license = lib.licenses.mit; 37 + maintainers = [ lib.maintainers.vbgl ]; 38 inherit (src.meta) homepage; 39 }; 40 }
+9 -9
pkgs/top-level/ocaml-packages.nix
··· 413 414 js_of_ocaml-ppx = callPackage ../development/tools/ocaml/js_of_ocaml/ppx.nix {}; 415 416 - js_of_ocaml-ppx_deriving_json = callPackage ../development/tools/ocaml/js_of_ocaml/ppx_deriving_json.nix { 417 - ppxlib = ppxlib.override { version = "0.12.0"; }; 418 - }; 419 420 js_of_ocaml-tyxml = callPackage ../development/tools/ocaml/js_of_ocaml/tyxml.nix {}; 421 ··· 815 816 ppx_deriving_protobuf = callPackage ../development/ocaml-modules/ppx_deriving_protobuf {}; 817 818 - ppx_deriving_rpc = callPackage ../development/ocaml-modules/ppx_deriving_rpc {}; 819 820 ppx_deriving_yojson = callPackage ../development/ocaml-modules/ppx_deriving_yojson {}; 821 ··· 824 ppx_import = callPackage ../development/ocaml-modules/ppx_import {}; 825 826 ppx_irmin = callPackage ../development/ocaml-modules/irmin/ppx.nix { 827 - ppxlib = ppxlib.override { version = "0.12.0"; }; 828 }; 829 830 ppx_sqlexpr = callPackage ../development/ocaml-modules/sqlexpr/ppx.nix {}; ··· 965 janeStreet = 966 if lib.versionOlder "4.08" ocaml.version 967 then import ../development/ocaml-modules/janestreet/0.13.nix { 968 - inherit ctypes janePackage num octavius re; 969 inherit (pkgs) openssl; 970 - ppxlib = ppxlib.override { version = "0.12.0"; }; 971 } 972 else if lib.versionOlder "4.07" ocaml.version 973 then import ../development/ocaml-modules/janestreet/0.12.nix { 974 - inherit ctypes janePackage num octavius ppxlib re; 975 inherit (pkgs) openssl; 976 } 977 else import ../development/ocaml-modules/janestreet { 978 inherit janePackage ocamlbuild angstrom ctypes cryptokit; 979 inherit magic-mime num ocaml-migrate-parsetree octavius ounit; 980 - inherit ppx_deriving re ppxlib; 981 inherit (pkgs) openssl; 982 }; 983 984 janeStreet_0_9_0 = import ../development/ocaml-modules/janestreet/old.nix {
··· 413 414 js_of_ocaml-ppx = callPackage ../development/tools/ocaml/js_of_ocaml/ppx.nix {}; 415 416 + js_of_ocaml-ppx_deriving_json = callPackage ../development/tools/ocaml/js_of_ocaml/ppx_deriving_json.nix { }; 417 418 js_of_ocaml-tyxml = callPackage ../development/tools/ocaml/js_of_ocaml/tyxml.nix {}; 419 ··· 813 814 ppx_deriving_protobuf = callPackage ../development/ocaml-modules/ppx_deriving_protobuf {}; 815 816 + ppx_deriving_rpc = callPackage ../development/ocaml-modules/ppx_deriving_rpc { 817 + ppxlib = ppxlib.override { legacy = true; }; 818 + }; 819 820 ppx_deriving_yojson = callPackage ../development/ocaml-modules/ppx_deriving_yojson {}; 821 ··· 824 ppx_import = callPackage ../development/ocaml-modules/ppx_import {}; 825 826 ppx_irmin = callPackage ../development/ocaml-modules/irmin/ppx.nix { 827 }; 828 829 ppx_sqlexpr = callPackage ../development/ocaml-modules/sqlexpr/ppx.nix {}; ··· 964 janeStreet = 965 if lib.versionOlder "4.08" ocaml.version 966 then import ../development/ocaml-modules/janestreet/0.13.nix { 967 + inherit ctypes janePackage num octavius ppxlib re; 968 inherit (pkgs) openssl; 969 } 970 else if lib.versionOlder "4.07" ocaml.version 971 then import ../development/ocaml-modules/janestreet/0.12.nix { 972 + inherit ctypes janePackage num octavius re; 973 inherit (pkgs) openssl; 974 + ppxlib = ppxlib.override { legacy = true; }; 975 } 976 else import ../development/ocaml-modules/janestreet { 977 inherit janePackage ocamlbuild angstrom ctypes cryptokit; 978 inherit magic-mime num ocaml-migrate-parsetree octavius ounit; 979 + inherit ppx_deriving re; 980 inherit (pkgs) openssl; 981 + ppxlib = ppxlib.override { legacy = true; }; 982 }; 983 984 janeStreet_0_9_0 = import ../development/ocaml-modules/janestreet/old.nix {