zio-0.1.0.2: docs/BuildNotes.md
# Building
Many of the notes below should work outside of Nix,
by omitting the nix-specific commands or flags.
## Updating cabal build file
```
$ nix-shell -p haskellPackages.hpack cabal2nix
$ hpack --force # force may not be necessary
$ cabal2nix --shell . > package-shell.nix
```
## Build the project
### Cabal
Note, if things go poorly, it is always worth trying
`cabal --enable-nix clean` or maybe `cabal clean` as well.
At this point, you can exit the shell used to generate
the `.cabal` and `.nix` file if you haven't already.
First, make cabal-install available if it isn't, then
run the build.
```
$ nix-shell -p cabal-install
$ nix-shell shell.nix --run "cabal build"
```
Note that `shell.nix` is a wrapper for the generated
`package-shell.nix` that only servers to pin nixpkgs,
so you could either change the version on nixpkgs in
`shell.nix` or run `nix-shell shell.nix --run "cabal build"`
directly, which would use your existing nixpkgs channel.
Of course, this is less likely to work due to potential version
bound conflicts, but may be useful.
#### Package and release
```
$ nix-shell shell.nix --run "cabal sdist"
```
### Stack
```
$ nix-shell -p stack
$ stack --nix build
```
#### Generate documentation (haddocks)
```
$ stack --nix build --haddock
```