diff --git a/nix/frama-c.nix b/nix/frama-c.nix
index f08d99e7e70beb94921404daecfb337f3d1cba2b..b2c05af125643818bbe1720534998aa3b30fc347 100644
--- a/nix/frama-c.nix
+++ b/nix/frama-c.nix
@@ -6,6 +6,7 @@
 , makeWrapper
 , nix-gitignore
 , wrapGAppsHook
+, writeText
 # Generic
 , autoconf
 , findlib
@@ -78,11 +79,22 @@ stdenv.mkDerivation rec {
     "FRAMAC_INSTALLDIR=$(out)"
   ];
 
+  # Simpler for our test target
   postInstall = ''
     mkdir -p $build_dir
     tar -cf $build_dir/dir.tar .
   '';
 
+  # Required so that tests of external plugins can be excuted
+  postFixup = ''
+    cp -r $out/share/doc $out/doc
+  '';
+
+  # Required so that Frama-C libs are found after install
+  setupHook = writeText "setupHook.sh" ''
+    export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib"
+  '';
+
   meta = {
     description = "An extensible and collaborative platform dedicated to source-code analysis of C software";
     homepage = "http://frama-c.com/";