Skip to content

Commit 35cc977

Browse files
Merge request #732 README restructuring
2 parents 2cd2db9 + f6032cf commit 35cc977

File tree

1 file changed

+60
-37
lines changed

1 file changed

+60
-37
lines changed

README.md

Lines changed: 60 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# hnix
1010

11-
Haskell parser, evaluator and type checker for the Nix language.
11+
Parser, evaluator and type checker for the Nix language written in Haskell.
1212

1313

1414
## Contents
@@ -38,35 +38,74 @@ Tooling is WIP, `nix-shell` and `nix-store` are still used for their purpose, so
3838
## Getting Started
3939

4040
```
41+
# Note: --recursive
4142
git clone --recursive https://github.com/haskell-nix/hnix.git
4243
cd hnix
44+
```
45+
46+
47+
### Cachix prebuild binary caches
48+
49+
If you opt in to use of Nix environment, to accelerate processes, please, enable the official HNix Cachix binary cache:
50+
51+
1. Go through https://cachix.org/ and set it up.
52+
53+
2. Run: `cachix use hnix`
54+
55+
56+
### Development using Cabal
57+
58+
Cabal [Quickstart](https://cabal.readthedocs.io/en/3.4/nix-local-build.html).
59+
60+
1. (Optional), to enter the projects reproducible Nix environment:
61+
```
4362
nix-shell
44-
cabal v2-configure --enable-tests
63+
```
64+
65+
2. Building:
66+
```
67+
cabal v2-configure
4568
cabal v2-build
4669
```
4770

48-
Run testing:
49-
* Default:
50-
```
51-
cabal v2-test
52-
```
71+
3. Loading the project into `ghci` REPL:
72+
```
73+
cabal v2-repl
74+
```
5375

54-
* All:
55-
```
56-
env ALL_TESTS=yes cabal v2-test
57-
```
76+
4. Development status loop with amazing [`ghcid`](https://github.com/ndmitchell/ghcid):
77+
```
78+
ghcid --command="cabal v2-repl --repl-options=-fno-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-j"
79+
```
80+
(optional) To use projects reproducible environment, wrap `ghcid ...` command into a `nix-shell --command ' '`.
81+
82+
For simplicity alias it for your shell.
5883

59-
* Selected (list of tests is in `tests/Main.hs`):
60-
```
61-
env NIXPKGS_TESTS=yes PRETTY_TESTS=1 cabal v2-test
62-
```
84+
3. Testing:
6385

64-
Run built binary with Cabal (`--` is for separation between `cabal` & `hnix` args):
86+
* Default suite:
87+
```
88+
cabal v2-test
89+
```
90+
91+
* All available tests:
92+
```
93+
env ALL_TESTS=yes cabal v2-test
94+
```
95+
96+
* Selected (list of tests is in `tests/Main.hs`):
97+
```
98+
env NIXPKGS_TESTS=yes PRETTY_TESTS=1 cabal v2-test
99+
```
100+
101+
Run built binary with Cabal:
65102
```
66103
cabal v2-run hnix -- --help
67104
```
105+
(`--` is for separation between `cabal` & `hnix` args)
106+
68107

69-
## Using the REPL
108+
## Entering the HNix REPL
70109

71110
Enter REPL:
72111
```
@@ -81,25 +120,13 @@ hnix --eval -E '(import <nixpkgs> {}).pkgs.hello' --repl
81120
Use the `:help` command for a list of all available REPL commands.
82121

83122

84-
## Cachix prebuild binary caches
85-
86-
To autoload prebuild project dependencies - please, enable the official HNix Cachix binary cache:
87-
88-
1. Go through https://cachix.org/ and set it up.
89-
90-
2. Run: `cachix use hnix`
91-
92-
93123
## Building
94124

95125
### With benchmarks
96126

97-
To build `hnix` with benchmarks enabled:
127+
To run benchmarks:
98128

99129
```
100-
nix-shell
101-
cabal v2-configure --enable-tests --enable-benchmarks
102-
cabal v2-build
103130
cabal v2-bench
104131
```
105132

@@ -108,9 +135,7 @@ cabal v2-bench
108135
To build `hnix` with profiling enabled:
109136

110137
```
111-
nix-shell
112138
cabal v2-configure --enable-tests --enable-profiling --flags=profiling
113-
cabal v2-build
114139
cabal v2-run hnix -- <args> +RTS -p
115140
```
116141

@@ -119,9 +144,7 @@ cabal v2-run hnix -- <args> +RTS -p
119144
To build `hnix` for debugging, with full tracing output and stack traces:
120145

121146
```
122-
nix-shell
123147
cabal v2-configure --enable-tests --enable-profiling --flags=profiling --flags=tracing
124-
cabal v2-build
125148
cabal v2-run hnix -- -v5 --trace <args> +RTS -xc
126149
```
127150

@@ -134,18 +157,18 @@ Note that this will run quite slowly, but will give the most information as to w
134157

135158
2. You are free to chat with everyone on [Gitter](https://gitter.im/haskell-nix/Lobby).
136159

137-
3. When pull request is ready to be submitted, to save time - please, test it with:
160+
3. When the pull request is ready to be submitted, to save time - please, test it with:
138161

139162
```
140163
git submodule update --init --recursive
141164
nix-shell --run "LANGUAGE_TESTS=yes cabal v2-test"
142165
```
143166

144-
Please, check that all tests that were passing prior (most probably all tests mentioned in the command) are still passing for the PR, it is faster to chech that locally then through CI. It's OK if no new tests are passing.
167+
Please, check that all tests that were passing prior (most probably all tests mentioned in the command) are still passing for the PR, it is faster to check that locally than through CI. It's OK if no new tests are passing.
145168

146169
### Evaluating Nixpkgs with HNix
147170

148-
Currently the main high-level goal is to be able to evaluate all of Nixpkgs. To run this yourself, first build `hnix` with `nix-build`, then run the following command:
171+
Currently, the main high-level goal is to be able to evaluate all of Nixpkgs. To run this yourself, first build `hnix` with `nix-build`, then run the following command:
149172

150173
```
151174
./result/bin/hnix --eval -E "import <nixpkgs> {}" --find

0 commit comments

Comments
 (0)