This PR replaces the haskell4nix-based Nix setup with a Nix flakes + haskell.nix-based setup and adds a github action for building and caching it. It also replaces the existing default.nix and shell.nix files and turns them into a wrapper for the flake.nix so that nix-build and nix-shell keeps working as before. This allows us to deduplicate the Nix definitions and also allows these legacy commands to take advantage of the binary cache populated by the flake.
One useful feature of the old haskell4nix-based setup that we're losing with this transition is the ability to "inline" our dependencies in the dep folder using nix-thunk and work on them through that local checkout. Fortunately, it's still possible to work with local copies of the dependencies with a little more work:
For example, assume that there's a local chainweb-api copy at ../chainweb-api relative to the kda-tool repo.
Copy the cabal.project file: cp cabal.project cabal.project.local
In cabal.project.local, remove the source-repository-package section for chainweb-api and instead add ../chainweb-api/chainweb-api.cabal at the end of the packages: kda-tool.cabal line.
Start nix develop as usual, which will still use cabal.project.
In the shell, call cabal with --project-file=cabal.project.local in order to work with the local chainweb-api copy.
This PR replaces the
haskell4nix
-based Nix setup with a Nix flakes +haskell.nix
-based setup and adds a github action for building and caching it. It also replaces the existingdefault.nix
andshell.nix
files and turns them into a wrapper for theflake.nix
so thatnix-build
andnix-shell
keeps working as before. This allows us to deduplicate the Nix definitions and also allows these legacy commands to take advantage of the binary cache populated by the flake.One useful feature of the old
haskell4nix
-based setup that we're losing with this transition is the ability to "inline" our dependencies in thedep
folder usingnix-thunk
and work on them through that local checkout. Fortunately, it's still possible to work with local copies of the dependencies with a little more work:chainweb-api
copy at../chainweb-api
relative to thekda-tool
repo.cabal.project
file:cp cabal.project cabal.project.local
cabal.project.local
, remove thesource-repository-package
section forchainweb-api
and instead add../chainweb-api/chainweb-api.cabal
at the end of thepackages: kda-tool.cabal
line.nix develop
as usual, which will still usecabal.project
.cabal
with--project-file=cabal.project.local
in order to work with the localchainweb-api
copy.