From c01530f7d9df07f93fbbbab4cbd84fd039a60b60 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Mon, 28 Sep 2026 15:21:57 -0500 Subject: [PATCH] vimUtils.buildVimPlugin: don't copy the build directory with dontUnpack With dontUnpack there is no source directory to install from, so installPhase copied $NIX_BUILD_TOP instead: env-vars, .attrs.json, and .attrs.sh ended up in the plugin and pulled the whole stdenv into its closure. Skip the copy in that case and leave installing files to the caller's phases. Plugins that unpack keep an identical installPhase. Fixes #508465 --- .../vim/plugins/utils/build-vim-plugin.nix | 2 +- pkgs/test/vim/default.nix | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/editors/vim/plugins/utils/build-vim-plugin.nix b/pkgs/applications/editors/vim/plugins/utils/build-vim-plugin.nix index 9b426edb593e..1faf3bf64c02 100644 --- a/pkgs/applications/editors/vim/plugins/utils/build-vim-plugin.nix +++ b/pkgs/applications/editors/vim/plugins/utils/build-vim-plugin.nix @@ -43,7 +43,7 @@ target=$out/${rtpPath}/${path} mkdir -p $out/${rtpPath} - cp -r . $target + ${lib.optionalString (!(attrs.dontUnpack or false)) "cp -r . $target"} runHook postInstall ''; diff --git a/pkgs/test/vim/default.nix b/pkgs/test/vim/default.nix index 296409a7e035..4b0c770f0a85 100644 --- a/pkgs/test/vim/default.nix +++ b/pkgs/test/vim/default.nix @@ -25,6 +25,26 @@ lib.recurseIntoAttrs { vimrcConfig.packages.myVimPackage.start = with vimPlugins; [ vim-nix ]; }; + test_vim_plugin_dont_unpack = + let + plugin = vimUtils.buildVimPlugin { + pname = "vim-plugin-dont-unpack-test"; + version = "0"; + src = pkgs.writeText "probe.vim" ""; + dontUnpack = true; + buildPhase = '' + install -D "$src" "$out/colors/probe.vim" + ''; + }; + in + pkgs.runCommand "vim-plugin-dont-unpack-test" { } '' + test -f ${plugin}/colors/probe.vim + for file in env-vars .attrs.json .attrs.sh; do + test ! -e ${plugin}/"$file" + done + mkdir -p "$out" + ''; + # test that all vimPlugins have `passthru.vimPlugin = true` test-all-plugins-have-vimPlugin-true = let