Files
nixpkgs/pkgs/build-support/buildenv
Jade Lovelace b116ba58dc buildEnv: improve error messages a little bit
buildEnv didn't previously make it exceedingly clear that it was
responsible for errors so finding docs for it was less clear.

Now it says it was responsible and suggests ways to compare the paths,
but only prints this if it's in your critical path and hard-failed.

```
> pkgs.buildEnv error: two given paths contain a conflicting subpath:
>   `/nix/store/kiifd22fh7pcwzbljy0zznzaw3nq508c-hello-2.12.2/bin/hello' and
>   `/nix/store/3sxwkxdm96bn84rhn2g867shsi284qja-hello-2.12.2/bin/hello'
> hint: this may be caused by two different versions of the same package in buildEnv's `paths` parameter
> hint: `pkgs.nix-diff` can be used to compare derivations
```

Tested with:

```nix
let
  pkgs = import ./. { };
  pkgs' = pkgs.stdenv.__bootPackages.stdenv.__bootPackages.stdenv.__bootPackages;
in

pkgs'.buildEnv {
  name = "meow";
  paths = [
    pkgs'.hello
    (pkgs'.hello.overrideAttrs (old: {
      dontCheck = true;
      dontVersionCheck = true;
      postInstall = ''
        > $out/bin/hello
      '';
    }))
  ];
}
```
2025-06-09 12:23:03 -07:00
..