Merge branch 'main' into live-docs-preview
Some checks failed
Check for typos in the source tree / check-typos (push) Has been cancelled

This commit is contained in:
raf 2025-01-02 20:00:31 +03:00 committed by GitHub
commit fbe0d142e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,30 +9,35 @@
inherit (pkgs) vimPlugins; inherit (pkgs) vimPlugins;
inherit (lib.strings) isString; inherit (lib.strings) isString;
inherit (lib.lists) filter map; inherit (lib.lists) filter map;
inherit (builtins) path;
# alias to the internal configuration # alias to the internal configuration
vimOptions = config.vim; vimOptions = config.vim;
noBuildPlug = {pname, ...} @ attrs: let noBuildPlug = pname: let
src = inputs."plugin-${attrs.pname}"; input = inputs."plugin-${pname}";
in version = input.shortRev or input.shortDirtyRev or "dirty";
{ in {
version = src.shortRev or src.shortDirtyRev or "dirty"; # vim.lazy.plugins relies on pname, so we only set that here
outPath = src; # version isn't needed for anything, but inherit it anyway for correctness
inherit pname version;
outPath = path {
name = "${pname}-0-unstable-${version}";
path = input.outPath;
};
passthru.vimPlugin = false; passthru.vimPlugin = false;
} };
// attrs;
# build a vim plugin with the given name and arguments # build a vim plugin with the given name and arguments
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug # if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
# instead # instead
buildPlug = attrs: let buildPlug = attrs: let
src = inputs."plugin-${attrs.pname}"; input = inputs."plugin-${attrs.pname}";
in in
pkgs.vimUtils.buildVimPlugin ( pkgs.vimUtils.buildVimPlugin (
{ {
version = src.shortRev or src.shortDirtyRev or "dirty"; version = input.shortRev or input.shortDirtyRev or "dirty";
inherit src; src = input.outPath;
} }
// attrs // attrs
); );
@ -51,7 +56,7 @@
map ( map (
plug: plug:
if (isString plug) if (isString plug)
then pluginBuilders.${plug} or (noBuildPlug {pname = plug;}) then pluginBuilders.${plug} or (noBuildPlug plug)
else plug else plug
) (filter (f: f != null) plugins); ) (filter (f: f != null) plugins);