Slow evaluation of recursive dependency resolution (spago2nix-ree)

I’m developing this ‘*2nix’ tool for the language purescript: GitHub - thought2/spago2nix-ree: Generates a lock file for spago projects that can be built with nix

My main motivation was that dependency resolution is done by nix - so that only actual project sources have to be rebuilt if something changes in your project sources. In the already existing spago2nix this is not the case, everything has to be recompiled on any change.
With spago2nix-ree dependencies that are built once are stored in the nix store so you never have to build them again.

I’m glad that this feature actually already works! But there’s one huge problem: The evaluation phase is very long. For a project with about 10 dependencies one rebuild (without any code change) already takes one minute. No good :slight_smile: It’s really just evaluation, the dependencies don’t get rebuilt or so. Tbh, I thought that this would not happen because of the lazy evaluation and caching of derivations which inputs did not change.

Is there anything that I can do to that? The recursive build function can be found here: https://github.com/thought2/spago2nix-ree/blob/d9a6c9d767082a9a4b6134fc65989d7c911c0bef/build-package.nix#L19

maybe you can store the dependencies of a single package in the passthru and have the recursion function use that?

Awesome! That did the trick. Now the evaluation time is almost instantaneous.
So I’m passing down (and up again) a cache attr set that holds the built dependencies, so the lookup in the eval phase is much faster.

1 Like