@@ -40,6 +40,8 @@ let self =
40 && !(stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isx86)
40 && !(stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isx86)
41, enableDeadCodeElimination ? component.enableDeadCodeElimination
41, enableDeadCodeElimination ? component.enableDeadCodeElimination
43+, ghcOptions ? component.ghcOptions
43# Options for Haddock generation
45# Options for Haddock generation
44, doHaddock ? component.doHaddock # Enable haddock and hoogle generation
46, doHaddock ? component.doHaddock # Enable haddock and hoogle generation
45, doHoogle ? component.doHoogle # Also build a hoogle index
47, doHoogle ? component.doHoogle # Also build a hoogle index
@@ -180,10 +182,9 @@ let
180 ++ lib.optionals useLLVM [
182 ++ lib.optionals useLLVM [
181 "--ghc-option=-fPIC" "--gcc-option=-fPIC"
183 "--ghc-option=-fPIC" "--gcc-option=-fPIC"
185+ ++ map (o: ''--ghc${lib.optionalString (stdenv.hostPlatform.isGhcjs) "js"}-options="${o}"'') ghcOptions
185− setupGhcOptions = lib.optional (package.ghcOptions != null) '' --ghc${lib.optionalString (stdenv.hostPlatform.isGhcjs) "js"}-options="${package.ghcOptions}"'';
187 executableToolDepends =
188 executableToolDepends =
188 (lib.concatMap (c: if c.isHaskell or false
189 (lib.concatMap (c: if c.isHaskell or false
189 then builtins.attrValues (c.components.exes or {})
190 then builtins.attrValues (c.components.exes or {})
@@ -258,7 +259,7 @@ let
259 haddock = haddockBuilder {
260 haddock = haddockBuilder {
260 inherit componentId component package flags commonConfigureFlags
261 inherit componentId component package flags commonConfigureFlags
261− commonAttrs revision setupGhcOptions doHaddock
262+ commonAttrs revision doHaddock
262 doHoogle hyperlinkSource quickjump setupHaddockFlags
263 doHoogle hyperlinkSource quickjump setupHaddockFlags
263 needsProfiling configFiles preHaddock postHaddock pkgconfig;
264 needsProfiling configFiles preHaddock postHaddock pkgconfig;
@@ -336,7 +337,7 @@ let
336 buildPhase = ''
337 buildPhase = ''
337 runHook preBuild
338 runHook preBuild
338 # https://gitlab.haskell.org/ghc/ghc/issues/9221
339 # https://gitlab.haskell.org/ghc/ghc/issues/9221
339− $SETUP_HS build ${haskellLib.componentTarget componentId} -j$(($NIX_BUILD_CORES > 4 ? 4 : $NIX_BUILD_CORES)) ${lib.concatStringsSep " " (setupBuildFlags ++ setupGhcOptions)}
340+ $SETUP_HS build ${haskellLib.componentTarget componentId} -j$(($NIX_BUILD_CORES > 4 ? 4 : $NIX_BUILD_CORES)) ${lib.concatStringsSep " " setupBuildFlags}
340 runHook postBuild
341 runHook postBuild