|
1 | 1 | # DevEnv & CI - Maintenance Guide & Troubleshooting |
2 | 2 |
|
3 | | -This document is intended both for maintainers of the nix code and for developers facing issues with their development environment or with the CI system. |
| 3 | +This document is intended both for maintainers of the nix code and for developers facing issues with their development environment or with the CI system. Use CTRL-F to look for relevant keywords. |
4 | 4 |
|
5 | | -# Troubleshooting |
| 5 | +### 1) `nix develop` fails to enter the shell, `cabal build` fails when it shouldn't. |
6 | 6 |
|
| 7 | +In general when facing any problem related to the nix shell or cabal failing to build when it shouldn't, the first step is to make sure you are using the latest shell from master: first exit the nix shell, then `git pull --rebase origin master`, then re-enter the nix shell (i.e. run `nix develop`). |
7 | 8 |
|
8 | | -<div style="background-color: #FFFF0033; padding: 5px;"> |
| 9 | +If that fails, you might be facing a caching issue. In that case, try this before exiting and re-entering the nix shell: |
9 | 10 |
|
10 | | -`nix develop` fails to enter the shell, `cabal build` fails when it shouldn't. |
| 11 | +`rm -r ~/.cabal/{store,packages} plutus-metatheory/_build dist dist-newstyle` |
11 | 12 |
|
12 | | -</div> |
| 13 | +### 2) `nix develop` is updating the `flake.lock` file. |
13 | 14 |
|
14 | | -In general when facing any problem related to the nix shell or cabal failing to build when it shouldn't, the first step is to make sure you are using the latest shell from master: first exit the nix shell, then `git pull --rebase origin master`, then re-enter the nix shell (i.e. run `nix develop`). |
| 15 | +This should never happen, it is a bug in nix, and has been observed in version `2.26.1`. |
| 16 | +Downgrade or upgrade your nix installation to fix this issue. |
15 | 17 |
|
16 | | -If that fails, you might be facing a caching issue. In that case, try this before exiting and re-entering the nix shell: |
| 18 | +### 3) `cabal test all` fails |
17 | 19 |
|
18 | | -``` |
19 | | -rm -r ~/.cabal/{store,packages} plutus-metatheory/_build dist dist-newstyle |
20 | | -``` |
| 20 | +Sometimes cabal needs a `cabal build all` before it can successfully execute a `cabal test all`. |
21 | 21 |
|
22 | | -<div style="background-color: #FFFF0033; padding: 5px;"> |
| 22 | +### 4) How to update `hackage`, `haskell.nix` and `CHaP` |
23 | 23 |
|
24 | | -`nix develop` is updating the `flake.lock` file. |
25 | | -</div> |
| 24 | +`nix flake update haskell-nix` updates [haskell.nix](https://github.com/input-output-hk/haskell.nix). |
| 25 | +This should be done infrequently as it is likely to break the nix code. |
| 26 | +If you just want new packages from `hackage` or `CHaP` instead, you can independently run: |
| 27 | +`nix flake update hackage CHaP`. |
| 28 | +Then you can change the `index-state` in `cabal.project`: you pick an arbitrary date, and if it's too new, `cabal` will error out and suggest the latest known date which you can copy-paste. |
26 | 29 |
|
27 | | -This should never happen, it is a bug in nix, and has been observed in version `2.26.1`. |
28 | | -Downgrade your nix installation to fix this issue. |
| 30 | +### 5) How to change what gets build in CI |
| 31 | + |
| 32 | +Modify `nested-ci-jobs = {..}` in [./nix/outputs.nix](https://github.com/input-output-hk/haskell.nix). |
| 33 | + |
| 34 | +### 6) How to change what gets exposed in the flake outputs |
| 35 | + |
| 36 | +Modify `packages = {..}` in [./nix/outputs.nix](https://github.com/input-output-hk/haskell.nix). |
| 37 | + |
| 38 | +### 7) How to build fully static Haskell executables with Nix |
| 39 | + |
| 40 | +Look at `static-haskell-packages = {..}` in [./nix/outputs.nix](https://github.com/input-output-hk/haskell.nix). |
| 41 | + |
| 42 | +### 8) How to manage cross-compilation on Windows via Wine with Nix |
| 43 | + |
| 44 | +Look at `windows-hydra-jobs = {..}` in [./nix/outputs.nix](https://github.com/input-output-hk/haskell.nix). |
| 45 | + |
| 46 | +### 9) How to define build variants and cabal flags in the nix code |
29 | 47 |
|
| 48 | +The nix builds can be overridden inside [./nix/project.nix](https://github.com/input-output-hk/haskell.nix). |
| 49 | +New cabal flags and configuration options can be defined there. |
0 commit comments