Generate reference docs for functions that have RFC145 style
doc-comments.
1. function locations
`docs/lib/function-locations.nix` scans nixvim's extended lib,
extracting "position entries" via `unsafeGetAttrPos`.
This is then converted into a nixdoc `locations.json` map of
"function name" → "markdown location string".
2. mdbook menu
`docs/lib/menu.nix` renders a mdbook menu representing all page
entries.
3. markdown pages
`docs/lib/default.nix` expects a set of "page entries", which come
from `docs/lib/pages.nix` by default. It passes this data to
`function-locations.nix` and `menu.nix`, and uses it internally to
render markdown pages.
Page entries can contain a `file` to render using `nixdoc`, and also a
`markdown` attribute which will be included at the top of the docs.
Additionally, a `title` can be included. This forms the heading
`$name: $title`, where `name` is derived from the page's attr-path.
See https://github.com/nix-community/nixdoc
This is much faster than running `nix fmt`.
Running treefmt directly will use the treefmt installed in the current
shell. Running `nix fmt` will first re-evaluate the flake.
This commit replaces stub plugins with the shared ones from utils
module.
This also removes separate tests for checking python and lua
dependencies. This is now tested in the 'default' test thanks to
`pluginChecks` code.
This commit finalizes using shared utils stub plugins for
performance.byteCompileLua tests.
To re-use more code from utils module, 'pluginChecksFor', 'libChecksFor'
and 'pythonChecksFor' functions were introduced. These functions
generate a check code for the given plugins/libs names.
Previously only extraLuaPackages themselves were byte-compiled, not
theirs dependencies. This commit fixes that by compiling lua packages
recursively. It uses byte-compile-lua-lib.nix shared file.
Also this commit uses the shared stub lua libraries for extraLuaPackages
byte-compiling test.
This commit replaces custom lua plugins in tests with shared stub
plugins from utils module.
After this change the test has started to fail. Debugging this issue
I found out that dependencies of plugins weren't processed.
This commit improves the test assertion to detect duplicated
dependencies in this case and fixes the underlying issue by also
processing dependencies.
This commit introduces a shared utils module for future use in
performance tests. It includes lua libraries and plugins of various
types and dependencies. Additionally, it provides lua code snippets to
verify that all features supplied by the plugins are functioning
correctly.
Previously, to determine if a file is byte-compiled, a simple binary
file detection was used, specifically checking if it contained any null
bytes. This commit updates the check to read the file header and compare
it with a known LuaJIT header.
Previously path was concatenated using string interpolation. This commit
switches from string interpolation to path interpolation.
The problem is nix will copy the "${directory}" to a new store
object, meaning anything outside its root won't be available.
From the nix manual:
> A path in an interpolated expression is first copied into the Nix
> store, and the resulting string is the store path of the newly created
> store object.
https://nix.dev/manual/nix/2.28/language/string-interpolation#interpolated-expression
Users can specify which systems to use by having our `systems` input
follow a different file or flake:
```nix
{
inputs = {
# Here we list systems in a local file
inputs.systems.url = "path:./systems.nix";
inputs.systems.flake = false;
inputs.nixvim.url = "github:nix-community/nixvim";
# Here we override the list of systems with only our own
inputs.nixvim.inputs.systems.follows = "systems";
# ...
};
outputs = inputs: {
# ...
};
}
```
Alternatively, instead of users listing systems in a local file, they
can use an external flake, e.g.:
- github:nix-systems/default
- Exposes aarch64 and x86_64 for linux and darwin
- github:nix-systems/default-linux
- Exposes aarch64 and x86_64 for linux
- github:nix-systems/default-darwin
- Exposes aarch64 and x86_64 for darwin
- github:nix-systems/aarch64-darwin
- github:nix-systems/aarch64-linux
- github:nix-systems/x86_64-darwin
- github:nix-systems/x86_64-linux
See https://github.com/nix-systems/nix-systems