From 6ae78bfc94ed0954b0cebe6e3f2ea1fe5aabd65f Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Wed, 12 Feb 2025 10:54:54 -0600 Subject: [PATCH] build-neovim-plugin: format --- .../editors/neovim/build-neovim-plugin.nix | 73 +++++++++++-------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/pkgs/applications/editors/neovim/build-neovim-plugin.nix b/pkgs/applications/editors/neovim/build-neovim-plugin.nix index 6f9bda5b108b..18e1c550ade5 100644 --- a/pkgs/applications/editors/neovim/build-neovim-plugin.nix +++ b/pkgs/applications/editors/neovim/build-neovim-plugin.nix @@ -1,41 +1,50 @@ -{ lib -, stdenv -, lua -, toVimPlugin +{ + lib, + lua, + toVimPlugin, }: let # sanitizeDerivationName normalizeName = lib.replaceStrings [ "." ] [ "-" ]; in - # function to create vim plugin from lua packages that are already packaged in - # luaPackages - { - # the lua derivation to convert into a neovim plugin - luaAttr ? (lua.pkgs.${normalizeName attrs.pname}) - , ... - }@attrs: - let - originalLuaDrv = if (lib.typeOf luaAttr == "string") then - lib.warn "luaAttr as string is deprecated since September 2024. Pass a lua derivation directly ( e.g., `buildNeovimPlugin { luaAttr = lua.pkgs.plenary-nvim; }`)" lua.pkgs.${normalizeName luaAttr} - else luaAttr; +# function to create vim plugin from lua packages that are already packaged in +# luaPackages +{ + # the lua derivation to convert into a neovim plugin + luaAttr ? (lua.pkgs.${normalizeName attrs.pname}), + ... +}@attrs: +let + originalLuaDrv = + if (lib.typeOf luaAttr == "string") then + lib.warn + "luaAttr as string is deprecated since September 2024. Pass a lua derivation directly ( e.g., `buildNeovimPlugin { luaAttr = lua.pkgs.plenary-nvim; }`)" + lua.pkgs.${normalizeName luaAttr} + else + luaAttr; + luaDrv = originalLuaDrv.overrideAttrs (oa: { + version = attrs.version or oa.version; + rockspecVersion = oa.rockspecVersion; - luaDrv = originalLuaDrv.overrideAttrs (oa: { - version = attrs.version or oa.version; - rockspecVersion = oa.rockspecVersion; + extraConfig = '' + -- to create a flat hierarchy + lua_modules_path = "lua" + ''; + }); - extraConfig = '' - -- to create a flat hierarchy - lua_modules_path = "lua" - ''; - }); - - finalDrv = toVimPlugin (luaDrv.overrideAttrs(oa: attrs // { - nativeBuildInputs = oa.nativeBuildInputs or [] ++ [ - lua.pkgs.luarocksMoveDataFolder - ]; - version = "${originalLuaDrv.version}-unstable-${oa.version}"; - })); - in - finalDrv + finalDrv = toVimPlugin ( + luaDrv.overrideAttrs ( + oa: + attrs + // { + nativeBuildInputs = oa.nativeBuildInputs or [ ] ++ [ + lua.pkgs.luarocksMoveDataFolder + ]; + version = "${originalLuaDrv.version}-unstable-${oa.version}"; + } + ) + ); +in +finalDrv