nix-community.nixvim/docs/user-guide/extending-config.md
traxys 9cd3721adf
standalone: Allow to extend a standalone derivation with a new module (#1142)
This adds the `nixvimExtend` attribute to the generated standalone
derivation, this attribute takes a module as an argument and returns a
new standalone derivation with the initial module & the extended module
merged together.
2024-02-22 08:22:21 +01:00

846 B

Extending a standalone configuration

Given a nvim derivation obtained from makeNixvim or makeNivxmiWithModule it is possible to create a new derivation with additional options.

This is done through the nvim.nixvimExtend function. This function takes a NixOS module that is going to be merged with the currently set options.

This attribute is recursive, meaning that it can be applied an arbitrary number of times.

Example

{makeNixvimWithModule}: let
    first = makeNixvimWithModule {
        module = {
            extraConfigLua = "-- first stage";
        };
    };

    second = first.nixvimExtend {extraConfigLua = "-- second stage";};
    
    third = second.nixvimExtend {extraConfigLua = "-- third stage";};
in
    third

This will generate a init.lua that will contain the three comments from each stages.