Does cabal2nix save me compilation? - Nix

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

rednaZ

Does building via cabal2nix save me compilation of stackage dependencies because they can be taken care of by the nix cache?

Torsten Schmits

it requires that you use a nixpkgs snapshot for which there are build outputs present in the cache. you can also build your stuff once and push them to a cache.

rednaZ

But that cannot work if the dependency contains template haskell, can it?

Torsten Schmits

nix only cares about the inputs to a derivation for the store hash, so if your TH is generating code with nondeterministic values, it will not be noticed

Torsten Schmits

if you have a different reason to assume this, please describe!

rednaZ

I am thinking of the situation that because of template haskell in some stackage package the build output is different every time.

rednaZ

And I depend on that stackage package.

Torsten Schmits

if you build the package with nix and push it to a cache, it will be served when another build requests that package. the output doesn't factor into that process

rednaZ

That means, using the cache and building myself might yield different results.

Torsten Schmits

yes, though that would be true for any two individual builds, without using nix