@@ -1,12 +1,16 @@
1−# This is a simplified version of the ghcWithPackages wrapper in
2−# nixpkgs, adapted to work with the package database of a single
3−# component.
1+# The ghcForComponent function wraps ghc so that it is configured with
2+# the package database of all dependencies of a given component.
3+# It has been adapted from the ghcWithPackages wrapper in nixpkgs.
4+#
5+# This wrapper exists so that nix-shells for components will have a
6+# GHC automatically configured with the dependencies in the package
7+# database.
8+
49{ lib, stdenv, ghc, runCommand, lndir, makeWrapper
510}:
611
7−{ package
8−, configFiles
9−, postBuild ? ""
12+{ componentName # Full derivation name of the component
13+, configFiles # The component's "config" derivation
1014}:
1115
1216let
@@ -18,12 +22,11 @@ let
1822 docDir = "$out/share/doc/ghc/html";
1923 packageCfgDir = "${libDir}/package.conf.d";
2024
21−in runCommand "${ghc.name}-for-${package.identifier.name}" {
25+in runCommand "${componentName}-${ghc.name}" {
2226 preferLocalBuild = true;
2327 passthru = {
2428 inherit (ghc) version meta;
2529 baseGhc = ghc;
26− inherit package;
2730 };
2831} (
2932 ''