@@ -18,7 +18,7 @@
1818, preCheck ? null, postCheck ? null
1919, preInstall ? null, postInstall ? null
2020, preHaddock ? null, postHaddock ? null
21−, shellHook ? null
21+, shellHook ? ""
2222
2323, doCheck ? component.doCheck || haskellLib.isTest componentId
2424, doCrossCheck ? component.doCrossCheck || false
@@ -187,6 +187,11 @@ let
187187 inherit configFiles;
188188 };
189189
190+ # In order to let shell hooks make package-specific things like Hoogle databases
191+ shellHookApplied = if builtins.isString shellHook then shellHook else
192+ if builtins.isFunction shellHook then shellHook { inherit package shellWrappers; }
193+ else abort "shellHook should be a string or a function";
194+
190195 # the target dir for haddock documentation
191196 docdir = docoutput: docoutput + "/share/doc/" + componentId.cname;
192197
@@ -332,7 +337,7 @@ stdenv.mkDerivation ({
332337
333338 shellHook = ''
334339 export PATH="${shellWrappers}/bin:$PATH"
335− ${toString shellHook}
340+ ${shellHookApplied}
336341 '';
337342}
338343# patches can (if they like) depend on the version and revision of the package.