summary refs log tree commit diff
path: root/pkgs/development/tools/ocaml/findlib
diff options
context:
space:
mode:
authorGuillaume Girol <symphorien+git@xlumurb.eu>2021-12-26 12:00:00 +0000
committerGuillaume Girol <symphorien+git@xlumurb.eu>2021-12-26 12:00:00 +0000
commit79fb9f824ede89150e8c4df52e4ae02697cb437f (patch)
treee9c7d82d167d6974b3ce70b25fb4806d4315f02e /pkgs/development/tools/ocaml/findlib
parentcb372c3b8880e504b06946e8fb2ca9777c685505 (diff)
downloadnixpkgs-79fb9f824ede89150e8c4df52e4ae02697cb437f.tar
nixpkgs-79fb9f824ede89150e8c4df52e4ae02697cb437f.tar.gz
nixpkgs-79fb9f824ede89150e8c4df52e4ae02697cb437f.tar.bz2
nixpkgs-79fb9f824ede89150e8c4df52e4ae02697cb437f.tar.lz
nixpkgs-79fb9f824ede89150e8c4df52e4ae02697cb437f.tar.xz
nixpkgs-79fb9f824ede89150e8c4df52e4ae02697cb437f.tar.zst
nixpkgs-79fb9f824ede89150e8c4df52e4ae02697cb437f.zip
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.
Diffstat (limited to 'pkgs/development/tools/ocaml/findlib')
-rw-r--r--pkgs/development/tools/ocaml/findlib/default.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/development/tools/ocaml/findlib/default.nix b/pkgs/development/tools/ocaml/findlib/default.nix
index 497a8ce91c1..d42441db622 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 = {