@@ -179,6 +179,10 @@ stdenv.mkDerivation ({
179
179
# The directory containing the haddock documentation.
180
180
# `null' if no haddock documentation was built.
181
181
haddockDir = if doHaddock' then "${ docdir drv . doc } /html" else null ;
182
+ } // lib . optionalAttrs isDoctest {
183
+ # We could not figure out how to have separate `source` and `dist` outputs
184
+ # for doctest as it results in a circular references.
185
+ source = drv ;
182
186
} ;
183
187
184
188
meta = {
@@ -213,8 +217,7 @@ stdenv.mkDerivation ({
213
217
outputs = [ "out" ]
214
218
++ ( lib . optional enableSeparateDataOutput "data" )
215
219
++ ( lib . optional doHaddock' "doc" )
216
- ++ ( lib . optional keepSource "source" )
217
- ++ ( lib . optional isDoctest "dist" ) ;
220
+ ++ ( lib . optional ( keepSource && ! isDoctest ) "source" ) ;
218
221
219
222
# Phases
220
223
preInstallPhases = lib . optional doHaddock' "haddockPhase" ;
@@ -226,7 +229,12 @@ stdenv.mkDerivation ({
226
229
'' ;
227
230
228
231
configurePhase =
229
- ( lib . optionalString keepSource ''
232
+ ( lib . optionalString isDoctest ''
233
+ cp -r . $out
234
+ cd $out
235
+ chmod -R +w .
236
+ '' ) +
237
+ ( lib . optionalString ( keepSource && ! isDoctest ) ''
230
238
cp -r . $source
231
239
cd $source
232
240
chmod -R +w .
@@ -354,9 +362,7 @@ stdenv.mkDerivation ({
354
362
'' )
355
363
}
356
364
runHook postInstall
357
- '' + ( lib . optionalString isDoctest ''
358
- cp -r dist/ $dist/
359
- '' ) + ( lib . optionalString keepSource ''
365
+ '' + ( lib . optionalString ( keepSource && ! isDoctest ) ''
360
366
rm -rf dist
361
367
'' ) ;
362
368
0 commit comments