1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-21 17:59:41 +01:00
nixvim/lib/overlay.nix
Matt Sturgeon c53e0161c3 lib: simplify bootstrapping
Previously, `lib/top-level.nix` used an `_isExtended` flag to indicate
whether the provided `lib` was already extended. This made bootstrapping
unclear and introduced the possibility of circular construction.

All construction now flows through the lib-overlay, removing
`_isExtended`. As a result, `lib/top-level.nix` always receives the
final extended lib.

The `<flake>.lib.nixvim` output is now defined as:

    (lib.extend <nixvim>.lib.overlay).nixvim

The overlay now imports `top-level.nix` directly, making it the
canonical entrypoint for constructing Nixvim's section of the lib.

A clarifying doccomment was added to `lib/top-level.nix`.
2025-11-20 20:57:10 +00:00

37 lines
871 B
Nix

{ flake }:
/**
Overlay function extending the Nixpkgs `lib` with Nixvim's additions.
This function is intended to be passed to `lib.extend`.
# Examples
Importing the file directly:
```
lib.extend (import ./overlay.nix { flake = nixvim; })
```
Using the overlay from flake outputs:
```
lib.extend nixvim.lib.overlay
```
# Inputs
`lib`
: The final lib instance; the fixpoint of all extensions, including this one.
`prevLib`
: The lib instance prior to applying this overlay.
*/
lib: prevLib: {
# Add Nixvim's section to the lib
nixvim = import ./top-level.nix { inherit flake lib; };
# Extend the maintainers set with Nixvim-specific maintainers
maintainers = prevLib.maintainers // import ./maintainers.nix;
# Extend lib.types with Nixvim's custom types
types = prevLib.types // import ./types.nix { inherit lib; };
}