@@ -31,6 +31,7 @@
31, doHaddock ? component.doHaddock # Enable haddock and hoogle generation
31, doHaddock ? component.doHaddock # Enable haddock and hoogle generation
32, doHoogle ? component.doHoogle # Also build a hoogle index
32, doHoogle ? component.doHoogle # Also build a hoogle index
33, hyperlinkSource ? component.doHyperlinkSource # Link documentation to the source code
33, hyperlinkSource ? component.doHyperlinkSource # Link documentation to the source code
34+, keepSource ? component.keepSource # Build from `source` output in the store then delete `dist`
35# Profiling
36# Profiling
36, enableLibraryProfiling ? component.enableLibraryProfiling
37, enableLibraryProfiling ? component.enableLibraryProfiling
@@ -189,7 +190,8 @@ stdenv.mkDerivation ({
190 outputs = ["out" ]
191 outputs = ["out" ]
191 ++ (lib.optional enableSeparateDataOutput "data")
192 ++ (lib.optional enableSeparateDataOutput "data")
192− ++ (lib.optional doHaddock' "doc");
193+ ++ (lib.optional doHaddock' "doc")
194+ ++ (lib.optional keepSource "source");
195 preInstallPhases = lib.optional doHaddock' "haddockPhase";
197 preInstallPhases = lib.optional doHaddock' "haddockPhase";
@@ -200,7 +202,12 @@ stdenv.mkDerivation ({
200 ${buildPackages.haskell-nix.haskellPackages.hpack.components.exes.hpack}/bin/hpack
202 ${buildPackages.haskell-nix.haskellPackages.hpack.components.exes.hpack}/bin/hpack
203− configurePhase = ''
205+ configurePhase =
206+ (lib.optionalString keepSource ''
204 runHook preConfigure
211 runHook preConfigure
205 echo Configure flags:
212 echo Configure flags:
206 printf "%q " ${finalConfigureFlags}
213 printf "%q " ${finalConfigureFlags}
@@ -322,7 +329,9 @@ stdenv.mkDerivation ({
324 runHook postInstall
331 runHook postInstall
325− '';
332+ '' + (lib.optionalString keepSource ''
327 shellHook = ''
336 shellHook = ''
328 export PATH="${shellWrappers}/bin:$PATH"
337 export PATH="${shellWrappers}/bin:$PATH"