From 0a309311ddf4d4ae0539c75eea036775f3d54faa Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Wed, 23 Nov 2016 04:20:51 +0100 Subject: [PATCH] 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 ];