summary refs log tree commit diff
path: root/pkgs/applications/editors/vim/plugins/default.nix
blob: c6ef409d637b865953397436acbb8fd06e18445d (plain) (blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
# TODO check that no license information gets lost
{ callPackage, config, lib, vimUtils, vim, darwin, llvmPackages, luaPackages }:

let

  inherit (vimUtils.override {inherit vim;})
    buildVimPluginFrom2Nix vimGenDocHook vimCommandCheckHook;

  inherit (lib) extends;

  initialPackages = self: {
    # Convert derivation to a vim plugin.
    toVimPlugin = drv:
      drv.overrideAttrs(oldAttrs: {

        nativeBuildInputs = oldAttrs.nativeBuildInputs or [] ++ [
          vimGenDocHook
          vimCommandCheckHook
        ];
        passthru = (oldAttrs.passthru or {}) // {
          vimPlugin = true;
        };
      });
  };

  plugins = callPackage ./generated.nix {
    inherit buildVimPluginFrom2Nix;
    inherit (vimUtils) buildNeovimPluginFrom2Nix;
  };

  # TL;DR
  # * Add your plugin to ./vim-plugin-names
  # * run ./update.py
  #
  # If additional modifications to the build process are required,
  # add to ./overrides.nix.
  overrides = callPackage ./overrides.nix {
    inherit (darwin.apple_sdk.frameworks) Cocoa CoreFoundation CoreServices;
    inherit buildVimPluginFrom2Nix;
    inherit llvmPackages luaPackages;
  };

  aliases = if config.allowAliases then (import ./aliases.nix lib) else final: prev: {};

  extensible-self = lib.makeExtensible
    (extends aliases
      (extends overrides
        (extends plugins initialPackages)
      )
    );
in
  extensible-self