flake/legacyPackages: simplify makeNixvim, making it more powerful

Rather than nesting it as `config`, pass `makeNixvim`'s argument through
directly as a module.

This not only simplifies the implementation, but allows users to use
`makeNixvim` for any scenario where `makeNixvimWithModule` would normally
be required.
This commit is contained in:
Matt Sturgeon 2024-06-29 22:15:39 +01:00
parent 10f64e6c96
commit c062b976ef
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 4 additions and 9 deletions

View file

@ -75,9 +75,10 @@ If using the home-manager module, see [Home Manager Usage](./modules/hm.md) for
### Standalone usage
When using nixvim as a standalone derivation you can use the following functions, located in `<nixvim>.legacyPackages.${system}`:
- `makeNixvim`: This function takes an attribute set of options values as arguments
- `makeNixvim`: A simplified version of `makeNixvimWithModule` for when you only need to specify `module` and the other options can be left as the defaults.
This function's only argument is a nixvim module, e.g. `{ extraConfigLua = "print('hi')"; }`
- `makeNixvimWithModule`: This function takes an attribute set of the form: `{pkgs, extraSpecialArgs, module}`.
The only required argument is `module`, being a NixOS module. This gives access to the `imports`, `options`, `config` variables, and using functions like `{config, ...}: { ... }`.
The only required argument is `module`, being a nixvim module. This gives access to the `imports`, `options`, `config` variables, and using functions like `{config, ...}: { ... }`.
There are also some helper functions in `<nixvim>.lib.${system}` like:
- `check.mkTestDerivationFromNixvimModule`, taking the same arguments as `makeNixvimWithModule` and generates a check derivation.

View file

@ -9,13 +9,7 @@
{
legacyPackages = rec {
inherit makeNixvimWithModule;
makeNixvim =
configuration:
makeNixvimWithModule {
module = {
config = configuration;
};
};
makeNixvim = module: makeNixvimWithModule { inherit module; };
};
};
}