# Buck2 build system for Cabal projects

> Source: <https://discourse.haskell.org/t/buck2-build-system-for-cabal-projects/14770?page=2#post_31>
> Published: 2026-10-06 09:58:51+00:00

`master` ← `simonmar:buck2`

          opened 10:40AM - 05 Oct 26 UTC

 
 
 
I'm creating this as a draft for now, for discussion. It's not ready for merging[…](https://github.com/haskell/cabal/pull/12410) yet, but before I spend the time to write docs etc. I'd like to get a sense of whether the Cabal maintainers think this is worth polishing as is or whether we should do something different.
Background:
  * See the [README for haskell-buck2](https://github.com/simonmar/haskell-buck2) for what this is
  * [Discussion on discourse](https://discourse.haskell.org/t/buck2-build-system-for-cabal-projects/14770/29)
I've done a round of cleaning up and refactoring the (originally AI-generated) code, so it's in not bad shape. The internals are pretty well factored into distinct pieces and the effects are reasonably localised. It doesn't look to be abusing any Cabal APIs.  Someone more familiar with the Cabal internals might be able to find ways to factor things better though.
Main outstanding issues
*  We need to have a story for shipping/deploying [haskell-buck2](https://github.com/simonmar/haskell-buck2), which needs to be cloned (or copied) into the root of the Cabal project. It needs to be versioned somehow. Ship a tarball with Cabal or clone it on demand? One branch per Cabal release? Should there be a submodule in the Cabal repo, as in this PR? There's also a versioning issue with Buck2 itself, which moves in sync with its prelude so only certain releases of Buck2 will work with a particular prelude.
* No support for the new build hooks yet
* Some other missing features: `asm-sources`, `cmm-sources`, `js-sources`, `frameworks`, `c2hs`, `foreign-library`.
* Some tidying up of code/comments still needed.
* [X] Patches conform to the [coding conventions](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#other-conventions).
* [NOT YET] Any changes that could be relevant to users [have been recorded in the changelog](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#changelog).
  * [X] [Is the change significant?](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#is-my-change-significant) If so, remember to add `significance: significant` in the changelog file.
* [NOT YET] The documentation has been updated, if necessary.
* [NOT YET] [Manual QA notes](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#qa-notes) have been included.
* [X] Tests have been added. (*Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!*)
