5. Nix-style Local Builds¶
Nix-style local builds are a new build system implementation inspired by Nix.
The Nix-style local build system is commonly called “new-build” for short
cabal new-* family of commands that control it. However, those
names are only temporary until Nix-style local builds become the default.
This is expected to happen soon. For those who do not wish to use the new
functionality, the classic project style will not be removed immediately,
but these legacy commands will require the usage of the
v1- prefix as of
Cabal 3.0 and will be removed in a future release. For a future-proof
way to use these commands in a script or tutorial that anticipates the
possibility of another UI paradigm being devised in the future, there
v2- prefixed versions that will reference the same functionality
until such a point as it is completely removed from Cabal.
Nix-style local builds combine the best of non-sandboxed and sandboxed Cabal:
- Like sandboxed Cabal today, we build sets of independent local packages deterministically and independent of any global state. new-build will never tell you that it can’t build your package because it would result in a “dangerous reinstall.” Given a particular state of the Hackage index, your build is completely reproducible. For example, you no longer need to compile packages with profiling ahead of time; just request profiling and new-build will rebuild all its dependencies with profiling automatically.
- Like non-sandboxed Cabal today, builds of external packages are
~/.cabal/store, so that a package can be built once, and then reused anywhere else it is also used. No need to continually rebuild dependencies whenever you make a new sandbox: dependencies which can be shared, are shared.
Nix-style local builds were first released as beta in cabal-install 1.24. They currently work with all versions of GHC supported by that release: GHC 7.0 and later.
Some features described in this manual are not implemented. If you need them, please give us a shout and we’ll prioritize accordingly.
- 5.1. Quickstart
- 5.2. Cookbook
- 5.3. How it works
- 5.4. Commands
- 5.4.1. cabal new-configure
- 5.4.2. cabal new-update
- 5.4.3. cabal new-build
- 5.4.4. cabal new-repl
- 5.4.5. cabal new-run
- 5.4.6. cabal new-freeze
- 5.4.7. cabal new-bench
- 5.4.8. cabal new-test
- 5.4.9. cabal new-haddock
- 5.4.10. cabal new-exec
- 5.4.11. cabal new-install
- 5.4.12. cabal new-clean
- 5.4.13. cabal new-sdist
- 5.5. Configuring builds with cabal.project
- 5.5.1. Specifying the local packages
- 5.5.2. Global configuration options
- 5.5.3. Solver configuration options
- 5.5.4. Package configuration options
- 5.5.5. Advanced global configuration options