docs/helpers: document the "extended" lib

This commit is contained in:
Matt Sturgeon 2024-08-20 23:38:01 +01:00
parent e41696e502
commit e555ba13b1
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -1,16 +1,17 @@
# Helpers # Helpers
If Nixvim is built using the standalone method, you can access our `helpers` as a module arg: If Nixvim is built using the standalone method, you can access our "helpers" as part of the `lib` module arg:
```nix ```nix
{ helpers, ... }: { lib, ... }:
{ {
# Your config # You can use lib.nixvim in your config
fooOption = lib.nixvim.mkRaw "print('hello')";
} }
``` ```
If Nixvim is being used as as a home-manager module, a nixos module, or as a dawwin module, If Nixvim is being used as as a home-manager module, a nixos module, or as a dawwin module,
helpers can be accessed via the `config.lib` option: our "helpers" can be accessed via the `config.lib` option:
```nix ```nix
{ config, ... }: { config, ... }:
@ -22,6 +23,8 @@ in
} }
``` ```
**Note:** the `lib` argument passed to modules is entirely unrelated to the `lib` _option_ accessed as `config.lib`!
A certain number of helpers are defined that can be useful: A certain number of helpers are defined that can be useful:
- `helpers.emptyTable`: An empty lua table `{}` that will be included in the final lua configuration. - `helpers.emptyTable`: An empty lua table `{}` that will be included in the final lua configuration.