https://github.com/juspay/haskell-incremental-build-template
A template for incremental Haskell builds using Nix
https://github.com/juspay/haskell-incremental-build-template
Last synced: about 1 month ago
JSON representation
A template for incremental Haskell builds using Nix
- Host: GitHub
- URL: https://github.com/juspay/haskell-incremental-build-template
- Owner: juspay
- License: mit
- Created: 2025-04-11T06:08:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-13T08:34:02.000Z (about 1 year ago)
- Last Synced: 2025-10-25T05:45:01.439Z (9 months ago)
- Language: Nix
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 9
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# haskell-incremental-build-template
> [!IMPORTANT]
> This minimal template focuses solely on incremental Haskell build configuration with Nix.
> For a more batteries-included Haskell Nix template, combine it with
> [!IMPORTANT]
> Requires GHC >= 9.4
A template for incremental Haskell builds using Nix, leveraging [nixpkgs’s Haskell incremental build system](https://github.com/NixOS/nixpkgs/blob/30a7bc1176cd9cd066cd75b9339872fa985a6379/doc/languages-frameworks/haskell.section.md?plain=1#L469-L515) and [haskell-flake]
## Getting Started
For an existing Haskell project already using [haskell-flake], integrate this template by:
- Add the `prev` flake input (see [flake.nix](./flake.nix)).
https://github.com/juspay/haskell-incremental-build-template/blob/7432331400f27924d827fbf81de5140c1fa0052c/flake.nix#L10-L14
- Include settings from [haskell.nix](./nix/modules/flake/haskell.nix):
https://github.com/juspay/haskell-incremental-build-template/blob/7432331400f27924d827fbf81de5140c1fa0052c/nix/modules/flake/haskell.nix#L20-L32
- Use [Find Latest Cached Commit](./.github/actions/find-latest-cached-commit) action to find the commit hash with cached build artifacts.
https://github.com/juspay/haskell-incremental-build-template/blob/efd179a97b078634db3f124e862260d3acc35499/.github/workflows/ci.yaml#L30-L48
[haskell-flake]: https://github.com/srid/haskell-flake
## Quick Trial
- Clone the repository: `git clone https://github.com/juspay/haskell-incremental-build-template && cd haskell-incremental-build-template`
- Perform a full build: `nix build .#default -L`
- This builds both `Example.hs` and `Main.hs` modules.
- Add a newline to `Main.hs` to simulate a change: `echo >> src/Main.hs`
- Perform an incremental build: `nix build .#default --override-input prev github:juspay/haskell-incremental-build-template -L`
- Only `Main.hs` is rebuilt.