@@ -1,4 +1,4 @@
1−{ stdenv, buildPackages, buildHaskellPackages, ghc
1+{ lib, stdenv, buildPackages, buildHaskellPackages, ghc
22, jailbreak-cabal, hscolour, cpphs, nodejs
33, ghcWithHoogle, ghcWithPackages
44}:
@@ -22,10 +22,10 @@ in
2222, buildFlags ? []
2323, haddockFlags ? []
2424, description ? null
25−, doCheck ? !isCross && stdenv.lib.versionOlder "7.4" ghc.version
25+, doCheck ? !isCross && lib.versionOlder "7.4" ghc.version
2626, doBenchmark ? false
2727, doHoogle ? true
28−, doHaddockQuickjump ? doHoogle && stdenv.lib.versionAtLeast ghc.version "8.6"
28+, doHaddockQuickjump ? doHoogle && lib.versionAtLeast ghc.version "8.6"
2929, editedCabalFile ? null
3030# aarch64 outputs otherwise exceed 2GB limit
3131, enableLibraryProfiling ? !(ghc.isGhcjs or stdenv.targetPlatform.isAarch64 or false)
@@ -36,14 +36,14 @@ in
3636, enableSharedLibraries ? !stdenv.hostPlatform.isStatic && (ghc.enableShared or false)
3737, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin
3838, enableStaticLibraries ? !(stdenv.hostPlatform.isWindows or stdenv.hostPlatform.isWasm)
39−, enableHsc2hsViaAsm ? stdenv.hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4"
39+, enableHsc2hsViaAsm ? stdenv.hostPlatform.isWindows && lib.versionAtLeast ghc.version "8.4"
4040, extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
4141# On macOS, statically linking against system frameworks is not supported;
4242# see https://developer.apple.com/library/content/qa/qa1118/_index.html
4343# They must be propagated to the environment of any executable linking with the library
4444, libraryFrameworkDepends ? [], executableFrameworkDepends ? []
4545, homepage ? "https://hackage.haskell.org/package/${pname}"
46−, platforms ? with stdenv.lib.platforms; all # GHC can cross-compile
46+, platforms ? with lib.platforms; all # GHC can cross-compile
4747, hydraPlatforms ? null
4848, hyperlinkSource ? true
4949, isExecutable ? false, isLibrary ? !isExecutable
@@ -71,7 +71,7 @@ in
7171, shellHook ? ""
7272, coreSetup ? false # Use only core packages to build Setup.hs.
7373, useCpphs ? false
74−, hardeningDisable ? stdenv.lib.optional (ghc.isHaLVM or false) "all"
74+, hardeningDisable ? lib.optional (ghc.isHaLVM or false) "all"
7575, enableSeparateBinOutput ? false
7676, enableSeparateDataOutput ? false
7777, enableSeparateDocOutput ? doHaddock
@@ -95,7 +95,7 @@ assert stdenv.hostPlatform.isWasm -> enableStaticLibraries == false;
9595
9696let
9797
98− inherit (stdenv.lib) optional optionals optionalString versionOlder versionAtLeast
98+ inherit (lib) optional optionals optionalString versionOlder versionAtLeast
9999 concatStringsSep enableFeature optionalAttrs;
100100
101101 isGhcjs = ghc.isGhcjs or false;
@@ -182,7 +182,7 @@ let
182182 parallelBuildingFlags = "-j$NIX_BUILD_CORES" + optionalString stdenv.isLinux " +RTS -A64M -RTS";
183183
184184 crossCabalFlagsString =
185− stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
185+ lib.optionalString isCross (" " + lib.concatStringsSep " " crossCabalFlags);
186186
187187 buildFlagsString = optionalString (buildFlags != []) (" " + concatStringsSep " " buildFlags);
188188
@@ -213,7 +213,7 @@ let
213213 (enableFeature doBenchmark "benchmarks")
214214 "--enable-library-vanilla" # TODO: Should this be configurable?
215215 (enableFeature enableLibraryForGhci "library-for-ghci")
216− ] ++ optionals (enableDeadCodeElimination && (stdenv.lib.versionOlder "8.0.1" ghc.version)) [
216+ ] ++ optionals (enableDeadCodeElimination && (lib.versionOlder "8.0.1" ghc.version)) [
217217 "--ghc-option=-split-sections"
218218 ] ++ optionals dontStrip [
219219 "--disable-library-stripping"
@@ -283,7 +283,7 @@ let
283283 continue
284284 fi
285285 '';
286−in stdenv.lib.fix (drv:
286+in lib.fix (drv:
287287
288288assert allPkgconfigDepends != [] -> pkg-config != null;
289289
@@ -423,7 +423,7 @@ stdenv.mkDerivation ({
423423
424424 echo configureFlags: $configureFlags
425425 ${setupCommand} configure $configureFlags 2>&1 | ${coreutils}/bin/tee "$NIX_BUILD_TOP/cabal-configure.log"
426− ${stdenv.lib.optionalString (!allowInconsistentDependencies) ''
426+ ${lib.optionalString (!allowInconsistentDependencies) ''
427427 if ${gnugrep}/bin/egrep -q -z 'Warning:.*depends on multiple versions' "$NIX_BUILD_TOP/cabal-configure.log"; then
428428 echo >&2 "*** abort because of serious configure-time warning from Cabal"
429429 exit 1
@@ -455,7 +455,7 @@ stdenv.mkDerivation ({
455455 ${optionalString doHoogle "--hoogle"} \
456456 ${optionalString doHaddockQuickjump "--quickjump"} \
457457 ${optionalString (isLibrary && hyperlinkSource) "--hyperlink-source"} \
458− ${stdenv.lib.concatStringsSep " " haddockFlags}
458+ ${lib.concatStringsSep " " haddockFlags}
459459 ''}
460460 runHook postHaddock
461461 '';
@@ -492,7 +492,7 @@ stdenv.mkDerivation ({
492492 done
493493 ''}
494494 ${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"}
495− ${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && stdenv.lib.versionOlder ghc.version "7.10") ''
495+ ${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && lib.versionOlder ghc.version "7.10") ''
496496 for exe in "${binDir}/"* ; do
497497 install_name_tool -add_rpath "$out/lib/ghc-${ghc.version}/${pname}-${version}" "$exe"
498498 done
@@ -535,7 +535,7 @@ stdenv.mkDerivation ({
535535 pkg-configDepends
536536 setupHaskellDepends
537537 ;
538− } // stdenv.lib.optionalAttrs doCheck {
538+ } // lib.optionalAttrs doCheck {
539539 inherit
540540 testDepends
541541 testFrameworkDepends
@@ -544,7 +544,7 @@ stdenv.mkDerivation ({
544544 testSystemDepends
545545 testToolDepends
546546 ;
547− } // stdenv.lib.optionalAttrs doBenchmark {
547+ } // lib.optionalAttrs doBenchmark {
548548 inherit
549549 benchmarkDepends
550550 benchmarkFrameworkDepends
@@ -561,7 +561,7 @@ stdenv.mkDerivation ({
561561 inherit propagatedBuildInputs otherBuildInputs allPkgconfigDepends;
562562 haskellBuildInputs = isHaskellPartition.right;
563563 systemBuildInputs = isHaskellPartition.wrong;
564− isHaskellPartition = stdenv.lib.partition
564+ isHaskellPartition = lib.partition
565565 isHaskellPkg
566566 (propagatedBuildInputs ++ otherBuildInputs ++ depsBuildBuild ++ nativeBuildInputs);
567567 };
@@ -608,13 +608,13 @@ stdenv.mkDerivation ({
608608 ghcEnv = withPackages (_:
609609 otherBuildInputsHaskell ++
610610 propagatedBuildInputs ++
611− stdenv.lib.optionals (!isCross) setupHaskellDepends);
611+ lib.optionals (!isCross) setupHaskellDepends);
612612
613− ghcCommandCaps = stdenv.lib.toUpper ghcCommand';
613+ ghcCommandCaps = lib.toUpper ghcCommand';
614614 in stdenv.mkDerivation ({
615615 inherit name shellHook;
616616
617− depsBuildBuild = stdenv.lib.optional isCross ghcEnvForBuild;
617+ depsBuildBuild = lib.optional isCross ghcEnvForBuild;
618618 nativeBuildInputs =
619619 [ ghcEnv ] ++ optional (allPkgconfigDepends != []) pkg-config ++
620620 collectedToolDepends;
@@ -623,7 +623,7 @@ stdenv.mkDerivation ({
623623 phases = ["installPhase"];
624624 installPhase = "echo $nativeBuildInputs $buildInputs > $out";
625625 LANG = "en_US.UTF-8";
626− LOCALE_ARCHIVE = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "glibc") "${buildPackages.glibcLocales}/lib/locale/locale-archive";
626+ LOCALE_ARCHIVE = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "${buildPackages.glibcLocales}/lib/locale/locale-archive";
627627 "NIX_${ghcCommandCaps}" = "${ghcEnv}/bin/${ghcCommand}";
628628 "NIX_${ghcCommandCaps}PKG" = "${ghcEnv}/bin/${ghcCommand}-pkg";
629629 # TODO: is this still valid?