diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix index 01561f4c2722..9f17bfa767e7 100644 --- a/pkgs/applications/editors/vim/configurable.nix +++ b/pkgs/applications/editors/vim/configurable.nix @@ -3,7 +3,7 @@ , libX11, libXext, libSM, libXpm, libXt, libXaw, libXau, libXmu , libICE , vimPlugins -, makeWrapper +, makeWrapper, makeBinaryWrapper , wrapGAppsHook , runtimeShell @@ -134,7 +134,9 @@ in stdenv.mkDerivation rec { ++ lib.optional wrapPythonDrv makeWrapper ++ lib.optional nlsSupport gettext ++ lib.optional perlSupport perl - ++ lib.optional (guiSupport == "gtk3") wrapGAppsHook + # Make the inner wrapper binary to avoid double wrapping issues with wrapPythonDrv + # (https://github.com/NixOS/nixpkgs/pull/164163) + ++ lib.optional (guiSupport == "gtk3") (wrapGAppsHook.override { makeWrapper = makeBinaryWrapper; }) ; buildInputs = [ @@ -177,37 +179,13 @@ in stdenv.mkDerivation rec { patchelf --set-rpath \ "$(patchelf --print-rpath $out/bin/vim):${lib.makeLibraryPath buildInputs}" \ "$out"/bin/vim - if [[ -e "$out"/bin/gvim ]]; then - patchelf --set-rpath \ - "$(patchelf --print-rpath $out/bin/vim):${lib.makeLibraryPath buildInputs}" \ - "$out"/bin/gvim - fi ln -sfn '${nixosRuntimepath}' "$out"/share/vim/vimrc - '' + lib.optionalString wrapPythonDrv '' + ''; + + postFixup = lib.optionalString wrapPythonDrv '' wrapProgram "$out/bin/vim" --prefix PATH : "${python3}/bin" \ --set NIX_PYTHONPATH "${python3}/${python3.sitePackages}" - '' + lib.optionalString (guiSupport == "gtk3") '' - - rewrap () { - rm -f "$out/bin/$1" - echo -e '#!${runtimeShell}\n"'"$out/bin/vim"'" '"$2"' "$@"' > "$out/bin/$1" - chmod a+x "$out/bin/$1" - } - - rewrap ex -e - rewrap view -R - rewrap gvim -g - rewrap gex -eg - rewrap gview -Rg - rewrap rvim -Z - rewrap rview -RZ - rewrap rgvim -gZ - rewrap rgview -RgZ - rewrap evim -y - rewrap eview -yR - rewrap vimdiff -d - rewrap gvimdiff -gd ''; dontStrip = true;