mirror of
https://github.com/vale981/nix-development-configs
synced 2025-03-04 09:21:39 -05:00
.. | ||
src | ||
test | ||
flake.lock | ||
flake.nix | ||
Main.hs | ||
package.yaml | ||
README.md |
Nix flake for an example haskell package
To get started:
- In the
package.yaml
, set any names beginning withexample
to your chosen name - for example, change thename
setting on the first line fromexample-package
to the nameof your new package. - Run
hpack
from the terminal; this will generate a cabal file for your project. - Run
cabal test
orcabal run ${executable-name}
, where${executable-name}
is the name of your executable, defined underexecutables
in thepackage.yaml
.
Overview of what's here This flake has a simple executable, a library that that executable depends on, and a test suite which tests the library.
It uses cabal to build, hpack as the format for the cabal project specification, and hspec to run tests.
Remember to run hpack after any changes to the package.yaml
, in order to re-create the ${project-name}.cabal
file, as well as the first time you try to use this.
The executable can be run via cabal using cabal run example-executable
, whereas tests can be run via cabal test
.