docs(nix/buildLisp): move example further up

Make "Example" the second section again since it got a bit buried under
a lot of detailed documentation you won't necessarily need right away.

Change-Id: I481354d1761c590e5872dfce8c3cf9934e278673
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3421
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
sterni 2021-08-26 12:34:47 +02:00
parent 2dd8bc7977
commit ea6ee1e219

View file

@ -88,6 +88,35 @@ the `expression` parameter should be a Lisp expression and will be evaluated
after loading all sources and dependencies (including library/program after loading all sources and dependencies (including library/program
dependencies). It must return a non-`NIL` value if the test suite has passed. dependencies). It must return a non-`NIL` value if the test suite has passed.
## Example
Using buildLisp could look like this:
```nix
{ buildLisp, lispPkgs }:
let libExample = buildLisp.library {
name = "lib-example";
srcs = [ ./lib.lisp ];
deps = with lispPkgs; [
(buildLisp.bundled "sb-posix")
iterate
cl-ppcre
];
};
in buildLisp.program {
name = "example";
deps = [ libExample ];
srcs = [ ./main.lisp ];
tests = {
deps = [ lispPkgs.fiveam ];
srcs = [ ./tests.lisp ];
expression = "(fiveam:run!)";
};
}
```
## Development REPLs ## Development REPLs
`buildLisp` builds loadable variants of both `program` and `library` derivations `buildLisp` builds loadable variants of both `program` and `library` derivations
@ -195,35 +224,6 @@ This only influences `meta.targets` which is read by depot's CI to
check which variants (see "Implementations") of the derivation to check which variants (see "Implementations") of the derivation to
build, so it may not be useful outside of depot. build, so it may not be useful outside of depot.
## Example
Using buildLisp could look like this:
```nix
{ buildLisp, lispPkgs }:
let libExample = buildLisp.library {
name = "lib-example";
srcs = [ ./lib.lisp ];
deps = with lispPkgs; [
(buildLisp.bundled "sb-posix")
iterate
cl-ppcre
];
};
in buildLisp.program {
name = "example";
deps = [ libExample ];
srcs = [ ./main.lisp ];
tests = {
deps = [ lispPkgs.fiveam ];
srcs = [ ./tests.lisp ];
expression = "(fiveam:run!)";
};
}
```
[sbcl]: http://www.sbcl.org/ [sbcl]: http://www.sbcl.org/
[ccl]: https://ccl.clozure.com/ [ccl]: https://ccl.clozure.com/
[ecl]: https://common-lisp.net/project/ecl/ [ecl]: https://common-lisp.net/project/ecl/