@@ -47,6 +47,7 @@ let self =
47 # ghc's internal linker seems to be broken on x86.
47 # ghc's internal linker seems to be broken on x86.
48 && !(stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isx86)
48 && !(stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isx86)
49, enableDeadCodeElimination ? component.enableDeadCodeElimination
49, enableDeadCodeElimination ? component.enableDeadCodeElimination
50+, writeHieFiles ? component.writeHieFiles
51, ghcOptions ? component.ghcOptions
52, ghcOptions ? component.ghcOptions
@@ -143,7 +144,15 @@ let
144 finalConfigureFlags = lib.concatStringsSep " " (
145 finalConfigureFlags = lib.concatStringsSep " " (
145 [ "--prefix=$out"
146 [ "--prefix=$out"
148+ # We don't specify this in 'commonConfigureFlags', as these are also
149+ # used by haddock-builder.nix. If we do specify these options in
150+ # commonConfigureFlags, then the haddock-builder will fail, because it
151+ # sets its own outputs which *don't* include $hie
152+ lib.optionals writeHieFiles [
153+ "--ghc-option=-fwrite-ide-info" "--ghc-option=-hiedir$hie"
147 # If configureAllComponents is set we should not specify the component
156 # If configureAllComponents is set we should not specify the component
148 # and Setup will attempt to configure them all.
157 # and Setup will attempt to configure them all.
149 if configureAllComponents
158 if configureAllComponents
@@ -345,7 +354,8 @@ let
346 outputs = ["out" ]
355 outputs = ["out" ]
347 ++ (lib.optional enableSeparateDataOutput "data")
356 ++ (lib.optional enableSeparateDataOutput "data")
348− ++ (lib.optional keepSource "source");
357+ ++ (lib.optional keepSource "source")
358+ ++ (lib.optional writeHieFiles "hie");
350 prePatch =
360 prePatch =
351 # emcc is very slow if it cannot cache stuff in $HOME
361 # emcc is very slow if it cannot cache stuff in $HOME