summaryrefslogtreecommitdiffstats
path: root/modules/default.nix
blob: c0c4bb0b692d7fb3d939a28fd0bb2be17a505f0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
  self,
  inputs,
  lib,
}: {
  pkgs,
  extraSpecialArgs ? {},
  modules ? [],
}: let
  inherit (builtins) toString;
  inherit (lib.lists) concatLists;

  # import modules.nix with `check`, `pkgs` and `lib` as arguments
  # check can be disabled while calling this file is called
  # to avoid checking in all modules
  nvimModules = import ./modules.nix {inherit pkgs lib;};

  # evaluate the extended library with the modules
  # optionally with any additional modules passed by the user
  module = lib.evalModules {
    specialArgs =
      extraSpecialArgs
      // {
        inherit self inputs;
        modulesPath = toString ./.;
      };
    modules = concatLists [
      nvimModules
      modules
    ];
  };
in {
  inherit (module) options config;
  inherit (module._module.args) pkgs;

  # Expose wrapped neovim-package for userspace
  # or module consumption.
  neovim = module.config.vim.build.finalPackage;
}