@@ -37,6 +37,9 @@
3737, enableLibraryProfiling ? component.enableLibraryProfiling
3838, enableExecutableProfiling ? component.enableExecutableProfiling
3939, profilingDetail ? component.profilingDetail
40+
41+# Data
42+, enableSeparateDataOutput ? component.enableSeparateDataOutput
4043}:
4144
4245let
@@ -69,7 +72,8 @@ let
6972 (if dontStrip then "--disable-library-stripping" else "--enable-library-stripping")
7073 (if enableLibraryProfiling then "--enable-library-profiling" else "--disable-library-profiling" )
7174 (if enableExecutableProfiling then "--enable-executable-profiling" else "--disable-executable-profiling" )
72− ] ++ lib.optional doHaddock' "--docdir=${docdir "$doc"}"
75+ ] ++ lib.optional enableSeparateDataOutput "--datadir=$data/share/${ghc.name}"
76+ ++ lib.optional doHaddock' "--docdir=${docdir "$doc"}"
7377 ++ lib.optional (enableLibraryProfiling || enableExecutableProfiling) "--profiling-detail=${profilingDetail}"
7478 ++ lib.optional (deadCodeElimination && stdenv.hostPlatform.isLinux) "--enable-split-sections"
7579 ++ lib.optional (static) "--enable-static"
@@ -154,7 +158,9 @@ stdenv.mkDerivation ({
154158
155159 SETUP_HS = setup + /bin/Setup;
156160
157− outputs = ["out" ] ++ (lib.optional doHaddock' "doc");
161+ outputs = ["out" ]
162+ ++ (lib.optional enableSeparateDataOutput "data")
163+ ++ (lib.optional doHaddock' "doc");
158164
159165 # Phases
160166 preInstallPhases = lib.optional doHaddock' "haddockPhase";
@@ -233,12 +239,15 @@ stdenv.mkDerivation ({
233239 ${ghc.targetPrefix}ghc-pkg -v0 --package-db ${configFiles}/package.conf.d -f $out/package.conf.d register ${name}.conf
234240 fi
235241 ''}
236− ${lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
242+ ${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
237243 mkdir -p $out/${name}
238244 if [ -f ${testExecutable} ]; then
239245 cp ${testExecutable} $out/${name}/
240246 fi
241− ''}
247+ '')
248+ # In case `setup copy` did not creat this
249+ + (lib.optionalString enableSeparateDataOutput "mkdir -p $data")
250+ }
242251 runHook postInstall
243252 '';
244253