Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Legacy Standalone Functions

Warning

The functions documented on this page are deprecated. New configurations should prefer nixvim.lib.evalNixvim.

See Standalone Usage for the recommended approach.

makeNixvim

makeNixvim is available at:

nixvim.legacyPackages.${system}.makeNixvim

It accepts a single Nixvim module and returns a Nixvim package.

nixvim.legacyPackages.${system}.makeNixvim {
  colorschemes.gruvbox.enable = true;
}

This is equivalent to evaluating a configuration and using its package output.

Tip

makeNixvim module is equivalent to makeNixvimWithModule { inherit module; }.

makeNixvimWithModule

makeNixvimWithModule is available at:

nixvim.legacyPackages.${system}.makeNixvimWithModule

It accepts an attribute set with the following fields:

  • module
  • pkgs
  • extraSpecialArgs

The only required field is module.

nixvim.legacyPackages.${system}.makeNixvimWithModule {
  module = ./config;
}

Test derivation helpers

check.mkTestDerivationFromNvim

Available at:

nixvim.lib.${system}.check.mkTestDerivationFromNvim

Accepts:

{
  name = "example";
  nvim = myNvim;
}

where nvim is a Nixvim package.

check.mkTestDerivationFromNixvimModule

Available at:

nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule

Accepts the same arguments as makeNixvimWithModule and produces a test derivation.

Extending an existing package

Packages produced by the legacy APIs expose an extend function.

{ makeNixvim }:

let
  first = makeNixvim {
    extraConfigLua = "-- first stage";
  };

  second = first.extend {
    extraConfigLua = "-- second stage";
  };

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

This produces:

-- first stage
-- second stage
-- third stage

The modern equivalent is configuration.extendModules.

Accessing configuration values

Legacy packages expose the evaluated configuration through the config attribute.

nvim.config

Accessing options

Legacy packages expose module options through the options attribute.

nvim.options

Migration

Legacy APIModern equivalent
makeNixvim module(evalNixvim { modules = [ module ]; }).config.build.package
makeNixvimWithModule args(evalNixvim { ... }).config.build.package
check.mkTestDerivationFromNixvimModule args(evalNixvim { ... }).config.build.test
check.mkTestDerivationFromNvim { name = ""; inherit nvim; }nvim.config.build.test
package.extend module((evalNixvim { ... }).extendModules { modules = [ module ]; }).config.build.package