From 0a309311ddf4d4ae0539c75eea036775f3d54faa Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Wed, 23 Nov 2016 04:20:51 +0100 Subject: [PATCH 1/3] ocamlPackages.topkg: make the installPhase independent of the package name It can then be reused as-is in other derivations (e.g., uucd). --- pkgs/development/ocaml-modules/topkg/default.nix | 11 +++-------- pkgs/development/ocaml-modules/uucd/default.nix | 8 +------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/pkgs/development/ocaml-modules/topkg/default.nix b/pkgs/development/ocaml-modules/topkg/default.nix index 1b1a127c536..23bcc267066 100644 --- a/pkgs/development/ocaml-modules/topkg/default.nix +++ b/pkgs/development/ocaml-modules/topkg/default.nix @@ -1,9 +1,7 @@ { stdenv, fetchurl, ocaml, findlib, ocamlbuild, result, opam }: -let ocaml-version = stdenv.lib.getVersion ocaml; in - stdenv.mkDerivation rec { - name = "ocaml${ocaml-version}-topkg-${version}"; + name = "ocaml${ocaml.version}-topkg-${version}"; version = "0.7.8"; src = fetchurl { @@ -16,12 +14,9 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ result ]; unpackCmd = "tar xjf ${src}"; - buildPhase = "ocaml -I ${findlib}/lib/ocaml/${ocaml-version}/site-lib/ pkg/pkg.ml build"; + buildPhase = "ocaml -I ${findlib}/lib/ocaml/${ocaml.version}/site-lib/ pkg/pkg.ml build"; createFindlibDestdir = true; - installPhase = '' - opam-installer --script --prefix=$out topkg.install | sh - mv $out/lib/topkg $out/lib/ocaml/${ocaml-version}/site-lib/ - ''; + installPhase = "opam-installer -i --prefix=$out --libdir=$OCAMLFIND_DESTDIR"; meta = { homepage = http://erratique.ch/software/topkg; diff --git a/pkgs/development/ocaml-modules/uucd/default.nix b/pkgs/development/ocaml-modules/uucd/default.nix index 73a0ccdacfe..d44309b266a 100644 --- a/pkgs/development/ocaml-modules/uucd/default.nix +++ b/pkgs/development/ocaml-modules/uucd/default.nix @@ -19,13 +19,7 @@ stdenv.mkDerivation rec { unpackCmd = "tar xjf $src"; - inherit (topkg) buildPhase; - - installPhase = '' - opam-installer --script --prefix=$out ${pname}.install > install.sh - sh install.sh - ln -s $out/lib/${pname} $out/lib/ocaml/${ocaml.version}/site-lib/ - ''; + inherit (topkg) buildPhase installPhase; propagatedBuildInputs = [ xmlm ]; From 66b9602a2fb61cc4ed2181ba43476fcc1740ce96 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Tue, 25 Oct 2016 19:19:35 +0200 Subject: [PATCH 2/3] ocamlPackages.fmt: init at 0.8.0 fmt is an OCaml library of Format pretty-printer combinators. Homepage: http://erratique.ch/software/fmt --- .../development/ocaml-modules/fmt/default.nix | 26 +++++++++++++++++++ pkgs/top-level/ocaml-packages.nix | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/development/ocaml-modules/fmt/default.nix diff --git a/pkgs/development/ocaml-modules/fmt/default.nix b/pkgs/development/ocaml-modules/fmt/default.nix new file mode 100644 index 00000000000..9994d156a4c --- /dev/null +++ b/pkgs/development/ocaml-modules/fmt/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg, cmdliner }: + +stdenv.mkDerivation { + name = "ocaml${ocaml.version}-fmt-0.8.0"; + + src = fetchurl { + url = http://erratique.ch/software/fmt/releases/fmt-0.8.0.tbz; + sha256 = "16y7ibndnairb53j8a6qgipyqwjxncn4pl9jiw5bxjfjm59108px"; + }; + + unpackCmd = "tar xjf $src"; + + buildInputs = [ ocaml findlib ocamlbuild opam topkg cmdliner ]; + + inherit (topkg) buildPhase installPhase; + + createFindlibDestdir = true; + + meta = { + homepage = http://erratique.ch/software/fmt; + license = stdenv.lib.licenses.isc; + description = "OCaml Format pretty-printer combinators"; + inherit (ocaml.meta) platforms; + maintainers = [ stdenv.lib.maintainers.vbgl ]; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 391e2c80a57..46f1ce4b023 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -176,6 +176,8 @@ let fix = callPackage ../development/ocaml-modules/fix { }; + fmt = callPackage ../development/ocaml-modules/fmt { }; + fontconfig = callPackage ../development/ocaml-modules/fontconfig { inherit (pkgs) fontconfig; }; From dd45d2552fd950dbaa3ec7c8eaf3fc5f8188aea1 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Tue, 25 Oct 2016 19:32:16 +0200 Subject: [PATCH 3/3] ocamlPackages.alcotest: 0.4.5 -> 0.7.2 --- .../ocaml-modules/alcotest/default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/development/ocaml-modules/alcotest/default.nix b/pkgs/development/ocaml-modules/alcotest/default.nix index ddc710bc7ed..bf0ae24ff03 100644 --- a/pkgs/development/ocaml-modules/alcotest/default.nix +++ b/pkgs/development/ocaml-modules/alcotest/default.nix @@ -1,15 +1,21 @@ -{ stdenv, buildOcaml, fetchzip, cmdliner, stringext }: +{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, topkg, opam, cmdliner, astring, fmt, result }: -buildOcaml rec { - name = "alcotest"; - version = "0.4.5"; +stdenv.mkDerivation rec { + name = "ocaml${ocaml.version}-alcotest-${version}"; + version = "0.7.2"; src = fetchzip { url = "https://github.com/mirage/alcotest/archive/${version}.tar.gz"; - sha256 = "1wcn9hkjf4cbnrz99w940qfjpi0lvd8v63yxwpnafkff871dwk6k"; + sha256 = "1qgsz2zz5ky6s5pf3j3shc4fjc36rqnjflk8x0wl1fcpvvkr52md"; }; - propagatedBuildInputs = [ cmdliner stringext ]; + buildInputs = [ ocaml findlib ocamlbuild opam topkg ]; + + propagatedBuildInputs = [ cmdliner astring fmt result ]; + + inherit (topkg) buildPhase installPhase; + + createFindlibDestdir = true; meta = with stdenv.lib; { homepage = https://github.com/mirage/alcotest;