Where is `callPackage` defined exactly? (part 2)

You can say that again… How long did it take for you to figure this out? The couple of lines in your answer are pretty dense with info, especially now that I’ve looked at pkgs/top-level/splice.nix. I’m still stuck at

in

{
  inherit splicePackages;

  # We use `callPackage' to be able to omit function arguments that can be
  # obtained `pkgs` or `buildPackages` and their `xorg` package sets. Use
  # `newScope' for sets of packages in `pkgs' (see e.g. `gnome' below).
  callPackage = pkgs.newScope {};

  callPackages = lib.callPackagesWith splicedPackagesWithXorg;

  newScope = extra: lib.callPackageWith (splicedPackagesWithXorg // extra);

  # Haskell package sets need this because they reimplement their own
  # `newScope`.
  __splicedPackages = splicedPackages // { recurseForDerivations = false; };
}

because it seems as if the callPackage definition calls the newScope one below. (And couldn’t even figure out where stage.nix comes into the picture.)

Fun times ahead:)