Adding Dependencies' Dependencies to HAREPATH

The current setup-hook for hare only handles first level dependencies added to nativeBuildInputs, that is, all hareThirdParty.<package> added to it have their /<store-path>/src/hare/third-party added to the HAREPATH variable.

Second level dependencies β€” ones declared inside the buildInputs of any hareThirdParty.<package>; see the hare-png PR, which depends on hare-compress, for an example β€” are not handled, so the user would need to add them manually to the nativeBuildInputs attribute of the package to be built.

How would one go about fixing this issue? In other words, how to add the dependencies of a Hare third party libary declared on its buildInputs to the HAREPATH of a package the uses it as one of its nativeBuildInputs?

Would hare’s setup-hook be a suitable way to fix this issue? Or would it be time to start thinking on creating buildHarePackage and buildHareThirdParty derivations?

Here’s an example with the dummy packages hare-foo, hare-bar, hare-foobar and hareprog.

hareprog’s recipe:

{ hare-foobar, hare }:
stdenv.mkDerivation (finalAttrs: {
  pname = "hareprog";
  version = "<version>";
  src = "<src>";
  nativeBuildInputs = [ hare-foobar ];

hare-foobar’s recipe:

{ hare-foo, hare-bar }:
stdenv.mkDerivation (finalAttrs: {
  pname = "hare-foobar";
  version = "<version>";
  src = "<src>";
  buildInputs = [ hare-foo hare-bar ];

How to make the HAREPATH in hareprog have not only /<store-path>/<hash>-hare-foobar-<version>/src/hare/third-party β€” as is the current behavior β€”, but also /<store-path>/<hash>-hare-foo-<version>/src/hare/third-party and /<store-path>/<hash>-hare-bar-<version>/src/hare/third-party?

How would you like buildHare... derivations to address this problem?

I would be for them β€” although we should keep an eye on the hare.ini issue, which may change the way Hare programs are built.

Any ideas how a buildHare... derivation could pull the dependencies of a dependency?

Note: I’ve came across this issue on the current state of the Hare framework thanks to your hare-png PR, @starzation. It’s the first hare third party library PR which brings a library β€” hare-png β€” that depends on another β€” hare-compress.

@starzation, I’ve found a way to propagate the dependencies: When a third party library depends on another, the dependency should be added to propagatedBuildInputs. By doing this, both the libraries on nativeBuildInputs β€” direct dependencies β€” and on propagatedBuildInputs β€” transitive dependencies β€” will be added to HAREPATH.

1 Like

Good news to see this resolve.