37 lines
1.0 KiB
Nix
37 lines
1.0 KiB
Nix
{
|
|
pkgs,
|
|
sloth,
|
|
callModule,
|
|
...
|
|
}: let
|
|
inherit (pkgs) vimUtils;
|
|
inherit (pkgs.lib) fix listToAttrs nameValuePair;
|
|
fs = pkgs.lib.fileset;
|
|
lua = callModule ../lua.nix {};
|
|
|
|
defsFile = luaDefs: with lua; writeLua "sloth-plugins-definitions.lua" (return luaDefs);
|
|
versionFile = with lua; writeLua "sloth-version.lua" (return (lambda [] (return sloth.version)));
|
|
in
|
|
fix (self: {
|
|
mkSlothPlugin = luaDefs:
|
|
vimUtils.buildVimPlugin {
|
|
inherit (sloth) version;
|
|
pname = "sloth-flake";
|
|
src = fs.toSource {
|
|
root = ../..;
|
|
fileset = ../../lua/sloth-flake;
|
|
};
|
|
nvimRequireCheck = "sloth-flake";
|
|
buildPhase = ''
|
|
dir=lua/sloth-flake
|
|
ln -s ${defsFile luaDefs} $dir/dependencies.lua
|
|
ln -s ${versionFile} $dir/version.lua
|
|
'';
|
|
};
|
|
|
|
mkPluginLuaDefinitions = plugins: let
|
|
extractDef = plugin: nameValuePair plugin.pluginName plugin.luaDefinition;
|
|
in
|
|
listToAttrs (map extractDef plugins);
|
|
})
|