@@ -49,10 +49,19 @@ let
4949 "extra-framework-dirs" = map (p: "${p}/Library/Frameworks") component.frameworks;
5050 })}
5151
52+ # Copy over the nonReinstallablePkgs from the global package db.
53+ # Note: we need to use --global-package-db with ghc-pkg to prevent it
54+ # from looking into the implicit global package db when registering the package.
55+ ${lib.concatMapStringsSep "\n" (p: ''
56+ ${ghc.targetPrefix}ghc-pkg describe ${p} | ${ghc.targetPrefix}ghc-pkg --force --global-package-db $out/package.conf.d register - || true
57+ '') nonReinstallablePkgs}
58+
5259 ${lib.concatMapStringsSep "\n" (p: ''
5360 ${ghc.targetPrefix}ghc-pkg --package-db ${p}/package.conf.d dump | ${ghc.targetPrefix}ghc-pkg --force --package-db $out/package.conf.d register -
5461 '') flatDepends}
55− ${flagsAndConfig "package-db" ["$out/package.conf.d"]}
62+
63+ # Note: we pass `clear` first to ensure that we never consult the implicit global package db.
64+ ${flagsAndConfig "package-db" ["clear" "$out/package.conf.d"]}
5665
5766 echo ${lib.concatStringsSep " " (lib.mapAttrsToList (fname: val: "--flags=${lib.optionalString (!val) "-" + fname}") flags)} >> $out/configure-flags
5867