docs: document new lib functions & usage

This commit is contained in:
technofab 2025-06-14 17:23:24 +02:00
parent 116f905b6c
commit bc36c39b09
No known key found for this signature in database
4 changed files with 93 additions and 6 deletions

53
docs/reference.md Normal file
View file

@ -0,0 +1,53 @@
# Reference
## `flakeModule`
The `flakeModule` for [flake-parts](https://flake.parts).
## `lib`
### `module`
The nix module for validation of inputs etc.
Used internally by `mkNixtestConfig`.
### `autodiscover`
```nix
autodiscover {
dir,
pattern ? ".*_test.nix",
}
```
Finds all test files in `dir` matching `pattern`.
Returns a list of modules (can be passed to `mkNixtest`'s `modules` arg).
### `mkNixtestConfig`
```nix
mkNixtestConfig {
modules,
args ? {},
}
```
Evaluates the test `modules`.
`args` are passed to the modules using `_module.args = args`.
**Noteworthy attributes**:
- `app`: nixtest wrapper
- `finalConfigJson`: derivation containing the tests json file
### `mkNixtest`
```nix
mkNixtest {
modules,
args ? {},
}
```
Creates the nixtest wrapper, using the tests in `modules`.
Basically `(mkNixtestConfig <arguments>).app`.