From 0dbca90d4129b6c4296b66899fd2750584b24c4f Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Tue, 10 May 2022 14:30:50 +0200 Subject: [PATCH] buildNeovimPluginFrom2Nix: use neovimRequireCheckHook and removed the addRtp call that was breaking overrideAttrs --- .../editors/vim/plugins/build-vim-plugin.nix | 9 ++------- .../editors/vim/plugins/neovim-require-check-hook.sh | 2 +- pkgs/applications/editors/vim/plugins/vim-utils.nix | 4 +++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/editors/vim/plugins/build-vim-plugin.nix b/pkgs/applications/editors/vim/plugins/build-vim-plugin.nix index e0978db4527..9dc5344ed28 100644 --- a/pkgs/applications/editors/vim/plugins/build-vim-plugin.nix +++ b/pkgs/applications/editors/vim/plugins/build-vim-plugin.nix @@ -7,11 +7,6 @@ }: rec { - addRtp = path: attrs: derivation: - derivation // { rtp = "${derivation}"; } // { - overrideAttrs = f: buildVimPlugin (attrs // f attrs); - }; - buildVimPlugin = attrs@{ name ? "${attrs.pname}-${attrs.version}", namePrefix ? "vimplugin-", @@ -25,14 +20,14 @@ rec { addonInfo ? null, ... }: - addRtp "${rtpPath}/${path}" attrs (stdenv.mkDerivation (attrs // { + (stdenv.mkDerivation (attrs // { name = namePrefix + name; # dont move the doc folder since vim expects it forceShare= [ "man" "info" ]; nativeBuildInputs = attrs.nativeBuildInputs or [] - ++ [ vimCommandCheckHook neovimRequireCheckHook ] + ++ [ vimCommandCheckHook ] ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) vimGenDocHook; inherit unpackPhase configurePhase buildPhase addonInfo preInstall postInstall; diff --git a/pkgs/applications/editors/vim/plugins/neovim-require-check-hook.sh b/pkgs/applications/editors/vim/plugins/neovim-require-check-hook.sh index 590f530954d..5b454e0ff01 100644 --- a/pkgs/applications/editors/vim/plugins/neovim-require-check-hook.sh +++ b/pkgs/applications/editors/vim/plugins/neovim-require-check-hook.sh @@ -9,7 +9,7 @@ neovimRequireCheckHook () { # editorconfig-checker-disable export HOME="$TMPDIR" - @nvimBinary@ -es -n -u NONE -i NONE --clean -V1 \ + @nvimBinary@ -es --headless -n -u NONE -i NONE --clean -V1 \ --cmd "set rtp+=$out" \ --cmd "lua require('$nvimRequireCheck')" fi diff --git a/pkgs/applications/editors/vim/plugins/vim-utils.nix b/pkgs/applications/editors/vim/plugins/vim-utils.nix index 69633d24c3c..9511e4da195 100644 --- a/pkgs/applications/editors/vim/plugins/vim-utils.nix +++ b/pkgs/applications/editors/vim/plugins/vim-utils.nix @@ -548,7 +548,9 @@ rec { # TODO placeholder to ease working on automatic plugin detection # this should be a luarocks "flat" install with appropriate vim hooks - buildNeovimPluginFrom2Nix = buildVimPluginFrom2Nix; + buildNeovimPluginFrom2Nix = attrs: let drv = (buildVimPluginFrom2Nix attrs); in drv.overrideAttrs(oa: { + nativeBuildInputs = oa.nativeBuildInputs ++ [ neovimRequireCheckHook ]; + }); # used to figure out which python dependencies etc. neovim needs requiredPlugins = {