{"slug": "teaser-pluggable-cabal-backends-and-a-nix-backend", "title": "Teaser: pluggable cabal backends and a Nix backend", "summary": "Developers have prototyped a version of cabal-install that turns Cabal into a frontend for pluggable build-system backends, with the original behavior retained as one option and a new Nix backend, cabal-sandstone, published on GitHub. The cabal-sandstone backend builds on incremental Nix builds for GHC already implemented in sandstone, and the authors say it frees users from manually obtaining GHC and foreign library dependencies while providing a centralized persistent cache via the Nix store, though it still trails Simon Marlow's Buck2-based cabal-buck2 command in absolute performance. The authors plan to upstream the changes bottom-up, first fixing longstanding architectural issues in Cabal and then decoupling its backend, rather than submitting one large pull request.", "body_md": "As is the trend,[@Ericson2314](https://discourse.haskell.org/u/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.\n\n[@simonmar](https://discourse.haskell.org/u/simonmar)’s [Buck2 build system](https://discourse.haskell.org/t/buck2-build-system-for-cabal-projects/14770) could become one of these (instead of an [external command](https://cabal.readthedocs.io/en/stable/external-commands.html)), and we’ve been implementing a Nix-backend as well. Incremental Nix builds for GHC had already been implemented in [sandstone](https://github.com/obsidiansystems/sandstone), so it was relatively easy to create this backend.\n\nHere’s a little demo showing the behavior of the “classic” backend vs. the Nix (cabal-sandstone) backend:\n\nThe code for the backend is available for anyone caring to look: [GitHub - parenthetical/cabal-sandstone: A Nix backend for Cabal · GitHub](https://github.com/parenthetical/cabal-sandstone) . The repository contains Git submodules linking to our Cabal fork (and many other forks ).\n\nAlthough the `cabal-sandstone` backend shares many advantages with the [cabal-buck2](https://github.com/simonmar/cabal-buck2) command, it still loses out absolute performance.\n\nHowever, 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.\n\nYou 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.)\n\nFor users who have tried building Haskell with Nix before, here are some differences from prior attempts to be aware of:\n\n`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](https://discourse.haskell.org/u/ericson2314)’s open/draft Cabal PRs for a sneak preview of what that first step entails.\n\nHappy to answer any questions", "url": "https://wpnews.pro/news/teaser-pluggable-cabal-backends-and-a-nix-backend", "canonical_source": "https://discourse.haskell.org/t/teaser-pluggable-cabal-backends-and-a-nix-backend/15261#post_1", "published_at": "2026-12-04 00:10:10+00:00", "updated_at": "2026-12-04 00:17:48.023553+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Cabal", "cabal-install", "cabal-sandstone", "Nix", "sandstone", "Buck2", "Simon Marlow", "Ericson2314"], "also_reported_by": [], "takeaway": "Cabal can now run as a frontend over pluggable backends, and the cabal-sandstone Nix backend resolves GHC and foreign library dependencies automatically while caching intermediate build artifacts in the Nix store, at the cost of absolute speed versus cabal-buck2.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/teaser-pluggable-cabal-backends-and-a-nix-backend", "markdown": "https://wpnews.pro/news/teaser-pluggable-cabal-backends-and-a-nix-backend.md", "text": "https://wpnews.pro/news/teaser-pluggable-cabal-backends-and-a-nix-backend.txt", "jsonld": "https://wpnews.pro/news/teaser-pluggable-cabal-backends-and-a-nix-backend.jsonld"}}