I’ve been trying to use Nix in correlation with Haskell/Stack/Haskell-language-server.
It’s very much been hit and miss, but one thing that seems apparent is that it take 1-2 hours to comple an initial nix-shell!! I’m no on a slow machine either, I have a MBP 2.4GHz 8-core i9, 32GB ram.
As an example I’ve been trying to run this project and specifically this file:
I commented out docker related things, but I’m now coming up to 2 hours!!
Is there something wrong in the setup or is this just normal?
If that is normal could I have an explanation as to why too?
Anything which isn’t cached by [cache.nixos.org](http://cache.nixos.org) you will need to build. What is cached? Ultimately, things that are transitive dependencies of the nixpkgs release jobs.
I suspect that, for example, haskell-language-server is not, and so is not cached. It is a big project with a lot of dependencies, so it will just take a long time (welcome to Haskell). On the plus side, after that you shouldn’t have to build it again.
However, I’m guessing here: it would help a lot if you told us what you end up building!
I would recommend looking into GitHub - target/lorri: Your project's nix-env , it will add gcroots automatically, so you don’t accidentally clean up your nix-shell’s dependency graph.
This won’t remove the rebuild completely, but it should amortize the cost
ah thank you for the replies, I do use cachix in other projects but I now assume they might still be building other non cached packages and why it felt like everything it taking much longer.
So say when I’ve used a library like Yesod in the past with just stack compilation with additional packages was never more than 5-10 minutes on fresh install. How is the way stack and nix differ?