Compare commits

..

2 commits

Author SHA1 Message Date
diniamo
d48f52f065 fix: add Gerg's suggestion 2024-08-09 09:29:41 +02:00
diniamo
1340eb34a0 style: improve code clarity 2024-08-09 09:29:29 +02:00

View file

@ -9,7 +9,7 @@ inputs: {
inherit (pkgs) vimPlugins; inherit (pkgs) vimPlugins;
inherit (lib.strings) isString toString; inherit (lib.strings) isString toString;
inherit (lib.lists) filter map concatLists; inherit (lib.lists) filter map concatLists;
inherit (lib.attrsets) recursiveUpdate getAttr; inherit (lib.attrsets) recursiveUpdate;
inherit (builtins) baseNameOf; inherit (builtins) baseNameOf;
# import modules.nix with `check`, `pkgs` and `lib` as arguments # import modules.nix with `check`, `pkgs` and `lib` as arguments
@ -32,14 +32,21 @@ inputs: {
# 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 = {pname, ...} @ attrs: let buildPlug = attrs: let
src = getAttr ("plugin-" + pname) inputs; src = inputs."plugin-${attrs.pname}";
in in
pkgs.stdenvNoCC.mkDerivation ({ pkgs.stdenvNoCC.mkDerivation ({
version = src.shortRev or src.shortDirtyRev or "dirty"; version = src.shortRev or src.shortDirtyRev or "dirty";
inherit src; inherit src;
nativeBuildInputs = with pkgs.vimUtils; [
vimCommandCheckHook
vimGenDocHook
neovimRequireCheckHook
];
passthru.vimPlugin = true;
buildPhase = lib.optionalString vimOptions.byteCompileLua '' buildPhase = lib.optionalString vimOptions.byteCompileLua ''
runHook preBuild runHook preBuild
find . -type f -name '*.lua' -exec luajit -bd -- {} {} \; find . -type f -name '*.lua' -exec luajit -bd -- {} {} \;
@ -59,30 +66,25 @@ inputs: {
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars); buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
pluginBuilders = {
nvim-treesitter = buildTreesitterPlug vimOptions.treesitter.grammars;
flutter-tools-patched =
buildPlug
{
pname = "flutter-tools";
patches = [../patches/flutter-tools.patch];
};
};
buildConfigPlugins = plugins: buildConfigPlugins = plugins:
map map
(plug: ( (
if (isString plug) plug:
then if (isString plug)
( then pluginBuilders.${plug} or (buildPlug {pname = plug;})
if (plug == "nvim-treesitter") else plug
then (buildTreesitterPlug vimOptions.treesitter.grammars) )
else if (plug == "flutter-tools-patched") (filter (f: f != null) plugins);
then
(
buildPlug
{
pname = "flutter-tools";
patches = [../patches/flutter-tools.patch];
}
)
else buildPlug {pname = plug;}
)
else plug
))
(filter
(f: f != null)
plugins);
# built (or "normalized") plugins that are modified # built (or "normalized") plugins that are modified
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins; builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;