nixpkgs/pkgs/applications/editors/vim/plugins/default.nix
Matthieu Coudron d4894355c1 vim/update.py: distinguish between vim/neovim plugins
I've been working for a long time towards automatic nix dependencies for
neovim plugins (using luarocks rockspecs to discover the said
dependencies).
This is an initial commit to help me complete the missing bits.
buildNeovimPluginFrom2Nix is right now a placeholder which helps me test
in my fork a version that does a flat install of luarocks.

the vim updater will now check for attributes with the same name in the lua package set,
if that's the case the script will generate buildNeovimPluginFrom2Nix.
2022-05-03 00:22:03 +02:00

53 lines
1.4 KiB
Nix

# 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