about summary refs log tree commit diff
path: root/pkgs/development/tools/ocaml/findlib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/ocaml/findlib/default.nix')
-rw-r--r--pkgs/development/tools/ocaml/findlib/default.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/development/tools/ocaml/findlib/default.nix b/pkgs/development/tools/ocaml/findlib/default.nix
index 497a8ce91c1d5..e7abf32eae5ff 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
-    preConfigureHooks+=(createOcamlDestDir)
+    # run before installPhase, even without buildInputs, and not in nix-shell
+    preInstallHooks+=(createOcamlDestDir)
+    # run even in nix-shell, and even without buildInputs
+    addEnvHooks "$hostOffset" exportOcamlDestDir
   '';
 
   meta = {