As is the trend,@Ericson2314 and I have been doing some LLM-assisted prototyping of Haskell devX improvements. We changed Cabal (cabal-install) into a frontend for build systems, making the original behavior just one of many backend options. If all goes well, Cabal’s commands will just keep working as normal with any backend.
@simonmar’s Buck2 build system could become one of these (instead of an external command), and we’ve been implementing a Nix-backend as well. Incremental Nix builds for GHC had already been implemented in sandstone, so it was relatively easy to create this backend.
Here’s a little demo showing the behavior of the “classic” backend vs. the Nix (cabal-sandstone) backend:
The code for the backend is available for anyone caring to look: GitHub - parenthetical/cabal-sandstone: A Nix backend for Cabal · GitHub . The repository contains Git submodules linking to our Cabal fork (and many other forks ).
Although the cabal-sandstone backend shares many advantages with the cabal-buck2 command, it still loses out absolute performance.
However, in return you are freed from worrying about how to get GHC, foreign library dependencies, etc. Getting all your build tools and libraries just happens magically, as long as they are correctly declared in your project and your project’s dependencies’ cabal files.
You also get a centralized persistent cache for (intermediate) build artifacts through the Nix store (I always end up with gigabytes of dist-newstyle spread over my worktrees.)
For users who have tried building Haskell with Nix before, here are some differences from prior attempts to be aware of:
cabal-sandstone in fact doesn’t use the Nix language at all, and certainly no “import from derivation”. All build plan are expressed with low-level “nix store layer” primitives, most notably We know our myriad Cabal changes are not going to go upstream in one giant PR. We have a plan to upstream the work “bottom-up”, first addressing some foundational longstanding architectural issues in Cabal, and then decoupling Cabal’s “backend” using that foundation. See some of @ericson2314’s open/draft Cabal PRs for a sneak preview of what that first step entails.
Happy to answer any questions