ocamlPackages.topkg: make the installPhase independent of the package name

It can then be reused as-is in other derivations (e.g., uucd).

+4 -15
+3 -8
pkgs/development/ocaml-modules/topkg/default.nix
··· 1 { stdenv, fetchurl, ocaml, findlib, ocamlbuild, result, opam }: 2 3 - let ocaml-version = stdenv.lib.getVersion ocaml; in 4 - 5 stdenv.mkDerivation rec { 6 - name = "ocaml${ocaml-version}-topkg-${version}"; 7 version = "0.7.8"; 8 9 src = fetchurl { ··· 16 propagatedBuildInputs = [ result ]; 17 18 unpackCmd = "tar xjf ${src}"; 19 - buildPhase = "ocaml -I ${findlib}/lib/ocaml/${ocaml-version}/site-lib/ pkg/pkg.ml build"; 20 createFindlibDestdir = true; 21 - installPhase = '' 22 - opam-installer --script --prefix=$out topkg.install | sh 23 - mv $out/lib/topkg $out/lib/ocaml/${ocaml-version}/site-lib/ 24 - ''; 25 26 meta = { 27 homepage = http://erratique.ch/software/topkg;
··· 1 { stdenv, fetchurl, ocaml, findlib, ocamlbuild, result, opam }: 2 3 stdenv.mkDerivation rec { 4 + name = "ocaml${ocaml.version}-topkg-${version}"; 5 version = "0.7.8"; 6 7 src = fetchurl { ··· 14 propagatedBuildInputs = [ result ]; 15 16 unpackCmd = "tar xjf ${src}"; 17 + buildPhase = "ocaml -I ${findlib}/lib/ocaml/${ocaml.version}/site-lib/ pkg/pkg.ml build"; 18 createFindlibDestdir = true; 19 + installPhase = "opam-installer -i --prefix=$out --libdir=$OCAMLFIND_DESTDIR"; 20 21 meta = { 22 homepage = http://erratique.ch/software/topkg;
+1 -7
pkgs/development/ocaml-modules/uucd/default.nix
··· 19 20 unpackCmd = "tar xjf $src"; 21 22 - inherit (topkg) buildPhase; 23 - 24 - installPhase = '' 25 - opam-installer --script --prefix=$out ${pname}.install > install.sh 26 - sh install.sh 27 - ln -s $out/lib/${pname} $out/lib/ocaml/${ocaml.version}/site-lib/ 28 - ''; 29 30 propagatedBuildInputs = [ xmlm ]; 31
··· 19 20 unpackCmd = "tar xjf $src"; 21 22 + inherit (topkg) buildPhase installPhase; 23 24 propagatedBuildInputs = [ xmlm ]; 25