compiling-to-categories / concat

Compiling to Categories
http://conal.net/papers/compiling-to-categories
BSD 3-Clause "New" or "Revised" License
431 stars 49 forks source link

Nixify the project's Cabal packages #77

Closed kenranunderscore closed 3 years ago

kenranunderscore commented 3 years ago

This adds an alternative way to develop the project using cabal-install by using Nix to manage the Cabal packages and their (not necessarily Haskell-only) dependencies.

Now it should be possible to simply enter a nix-shell in the project root and start building/testing the project with the cabal and ghc executables it provides. I've pinned nixpkgs to a commit that is known to work for us at Active Group and that contains GHC 8.10.4.

The ConCat packages are provided as a nixpkgs overlay (./nix/concat-overlay.nix) so that anyone who would want to use them can simply import the Nix expression and use the resulting overlay themselves. (This is also the main motivation for this PR as we're currently maintaining Nix expressions for the packages separately in our project; having them close to the source would enable us to use them for ConCat as well as for our own project).

Note: The cabal.project file contains relative paths to git checkouts of vector-sized and netlist/netlist-to-verilog/etc. For the nix-based development setup these are irrelevant as I've included the necessary packages in the pkgs.haskellPackages set. The version of vector-sized seemed to be recent enough for it to just work.

It's also possible to use nix-build to build any ConCat package, like this: nix-build nix/pkgs.nix -A haskellPackages.concat-known. But note that nix-build by default also runs the test suites, and concat-examples (for instance) fails.