Refactor `serve-docs` using `makeWrapper`, make it available as a
`serve-docs` package and as the `docs` "app".
This means `nix build .#docs` will build the docs while `nix run .#docs`
will run the server.
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
Replace the `package-options` test with a stricter implementation.
When evaluating modules for use in the docs, provide them with a stubbed
`pkgs` instance that throws an error whenever a package is evaluated.
This ensures we don't accidentally use any packages in defaults or
examples.
Add a non-system specific `<flake>.lib.nixvim` output, which is
equivalent to the existing `<flake>.lib.<system>.helpers` output.
This is now also wrapped with `lib.makeOverridable` to allow overriding
the function args used to construct the nixvim-lib.
Consistently access nixvim-lib via the new flake output, overriding
where necessary.
This minimal implementation allows `nixpkgs.pkgs` to be defined, but
does not implement evaluating an instance from a pkgsPath when _not_
defined.
The `defaultPkgs` specialArg is dropped in favour of `nixpkgs.pkgs`
being defined. If it's not defined, an assertion is thrown.
In the future, a nixpkgs source path can be supplied, defaulting to the
flake's `inputs.nixpkgs`. Along with other `nixpkgs.*` options, this
will allow a `pkgs` instance to be evaluated within the module eval.
By default `lib.evalModules` will check all config definitions match
a declared option (or a freeform type), leading to errors like:
error: The option `wrapRc' does not exist.
Setting `_module.freeformType` or `_module.check` will disable this,
allowing us to evaluate the option declaration without checking the
config definitions.
In the two places where our "helpers" lib is exclusively internal
(flake module args and building the docs), we no longer supply `pkgs`.
In the other 4 locations, we now note why we still do in a comment.
The old `default.nix` is inlined into the "lib" flake-module, which is
the only place it was used.
This allows "helpers" to take its rightful place at the root of `./lib` 👑
Replaced the `isDocs` specialArg added in #1807 with an internal module
option.
We should only use `specialArgs` when absolutely necessary, a module or
`_module.args` is preferred, but those aren't available until `config`
is evaluated so they can't be used for `imports`.
The main problem with `specialArgs` is it makes our modules less
portable.
Luckily that shouldn't be an issue for these context flags.
Let's simplify things by defining all modules in `./plugins`, `./modules`
and `./wrappers/modules`.
Instead of currying `pkgs` into a bootstrapping module, we can require
`defaultPkgs` be provided as a special arg.
This refactor allows us to completely remove `flake-modules/modules.nix`!
This speeds up evaluation and removes IFD. Additionally, this makes it
easier to maintain these library changes, as we don't have to maintain
static patches.
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit only adds Home-Manager specific options, we should add
sections for the different kind of modules too.
This is _not_ added to the man docs, as it is more complex. If need
arises we could look into how to do it.
This requires pulling quite a lot of code from nixpkgs in order to
make the `either` type work correctly, the effects can be seen for
example in the documentation of `ollama.promps` and `ollama.actions`
* docs: mdbook init
* Separate sub-options into their section
* docs: enable fold
* docs: merge core options into a single section
* doc generation: fix submodules index pages
* docs: add contributing section
* docs: rename 'core' group to 'Neovim Options'
docs: removed the index pages of empty sections
docs: remove obsolete 'mergeFunctionResults' function
* docs: use nix syntax highlighting
* docs: point to the new repo url
* docs: use recursive generation
docs: split submodules into subsections
* docs: fix contributing separator
docs: fix missing submodules docs
This represents a major rearchitecture for nixvim, so I'm leaving this up to track the progress for now, and to serve as a reference for any breaking changes during transition.
The main change is, of course, being able to use nixvim standalone. To do this, you should use the new build function, which takes in two arguments: the system architecture (e.g. x86_64-linux) and the configuration. For the new configuration, do not use the programs.nixvim. prefix.
For module development, the main change is that you should no longer prefix your modules with programs.nixvim..
You can now run `nix build '.#docs'` to build HTML documentation
documenting every single option on nixvim! Fortunately, thanks to
the 'description' field, most options are already documented, but
there are still a fair few that need documenting.
I will be taking care of those in the next few days. When those are
done, I will find a way to automatically rebuild documentation on every
repo push, and also add a PR hook requiring documentation.
Additionally, I will try to find a way to have per-page plugin docs.