From 79fb9f824ede89150e8c4df52e4ae02697cb437f Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Sun, 26 Dec 2021 12:00:00 +0000 Subject: [PATCH] ocamlPackages.findlib: don't wait configurePhase to set OCAMLFIND_DESTDIR this fixes ocamlfind printconf destdir inside nix-shell fixes #152028 the regression was introduced by a3ab43d3a45338f845a0f8a12ed34e84c8b79dae which was meant to fix building ocamlPackages.ocamlbuild with strictDeps. This commit keeps ocamlbuild building. --- pkgs/development/tools/ocaml/findlib/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/ocaml/findlib/default.nix b/pkgs/development/tools/ocaml/findlib/default.nix index 497a8ce91c1d..d42441db6225 100644 --- a/pkgs/development/tools/ocaml/findlib/default.nix +++ b/pkgs/development/tools/ocaml/findlib/default.nix @@ -36,15 +36,21 @@ stdenv.mkDerivation rec { export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs" fi } - createOcamlDestDir () { + exportOcamlDestDir () { export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml.version}/site-lib/" + } + createOcamlDestDir () { if test -n "''${createFindlibDestdir-}"; then mkdir -p $OCAMLFIND_DESTDIR fi } + # run for every buildInput addEnvHooks "$targetOffset" addOCamlPath + # run before configurePhase, even without buildInputs, and not in nix-shell preConfigureHooks+=(createOcamlDestDir) + # run even in nix-shell, and even without buildInputs + addEnvHooks "$hostOffset" exportOcamlDestDir ''; meta = {