diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix index bc317b91597e..d5dd00b4aa60 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, makeBinaryWrapper +, makeWrapper , wrapGAppsHook , runtimeShell @@ -133,9 +133,7 @@ in stdenv.mkDerivation rec { ++ lib.optional wrapPythonDrv makeWrapper ++ lib.optional nlsSupport gettext ++ lib.optional perlSupport perl - # 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; }) + ++ lib.optional (guiSupport == "gtk3") wrapGAppsHook ; buildInputs = [ diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper.sh index 986be5b9e113..7123f100c175 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper.sh @@ -33,6 +33,8 @@ assertExecutable() { # To troubleshoot a binary wrapper after you compiled it, # use the `strings` command or open the binary file in a text editor. makeWrapper() { + local NIX_CFLAGS_COMPILE NIX_CFLAGS_LINK + unset NIX_CFLAGS_COMPILE NIX_CFLAGS_LINK local original="$1" local wrapper="$2" shift 2 diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix index d0ea088bf71e..8c10f67c152c 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix @@ -1,7 +1,7 @@ { stdenv , lib , makeSetupHook -, makeWrapper +, makeBinaryWrapper , gobject-introspection , isGraphical ? true , gtk3 @@ -34,7 +34,7 @@ makeSetupHook { ] ++ [ # We use the wrapProgram function. - makeWrapper + makeBinaryWrapper ]; substitutions = { passthru.tests = let @@ -59,8 +59,8 @@ makeSetupHook { tested = basic; in testLib.runTest "basic-contains-dconf" ( testLib.skip stdenv.isDarwin '' - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GIO_EXTRA_MODULES=" "${dconf.lib}/lib/gio/modules"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GIO_EXTRA_MODULES=" "${dconf.lib}/lib/gio/modules"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GIO_EXTRA_MODULES" "${dconf.lib}/lib/gio/modules"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GIO_EXTRA_MODULES" "${dconf.lib}/lib/gio/modules"} '' ); @@ -98,8 +98,8 @@ makeSetupHook { typelib-user-has-gi-typelib-path = let tested = typelib-user; in testLib.runTest "typelib-user-has-gi-typelib-path" '' - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH=" "${typelib-Mahjong}/lib/girepository-1.0"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH=" "${typelib-Mahjong}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH" "${typelib-Mahjong}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH" "${typelib-Mahjong}/lib/girepository-1.0"} ''; # Simple derivation containing a gobject-introspection typelib in lib output. @@ -143,8 +143,8 @@ makeSetupHook { typelib-multiout-user-has-gi-typelib-path = let tested = typelib-multiout-user; in testLib.runTest "typelib-multiout-user-has-gi-typelib-path" '' - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH=" "${typelib-Bechamel.lib}/lib/girepository-1.0"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH=" "${typelib-Bechamel.lib}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH" "${typelib-Bechamel.lib}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH" "${typelib-Bechamel.lib}/lib/girepository-1.0"} ''; # Simple derivation that contains a typelib as well as a program using it. @@ -169,8 +169,8 @@ makeSetupHook { typelib-self-user-has-gi-typelib-path = let tested = typelib-self-user; in testLib.runTest "typelib-self-user-has-gi-typelib-path" '' - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH=" "${typelib-self-user}/lib/girepository-1.0"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH=" "${typelib-self-user}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH" "${typelib-self-user}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH" "${typelib-self-user}/lib/girepository-1.0"} ''; }; }; diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix index 1757bdbbe250..42866c3419dd 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix @@ -1,5 +1,4 @@ -{ runCommand -}: +{ lib, runCommand }: rec { runTest = name: body: runCommand name { } '' @@ -19,12 +18,14 @@ rec { ''; expectSomeLineContainingYInFileXToMentionZ = file: filter: expected: '' - if ! cat "${file}" | grep "${filter}"; then - ${fail "The file “${file}” should include a line containing “${filter}”."} + file=${lib.escapeShellArg file} filter=${lib.escapeShellArg filter} expected=${lib.escapeShellArg expected} + + if ! grep --text --quiet "$filter" "$file"; then + ${fail "The file “$file” should include a line containing “$filter”."} fi - if ! cat "${file}" | grep "${filter}" | grep ${expected}; then - ${fail "The file “${file}” should include a line containing “${filter}” that also contains “${expected}”."} + if ! grep --text "$filter" "$file" | grep --text --quiet "$expected"; then + ${fail "The file “$file” should include a line containing “$filter” that also contains “$expected”."} fi ''; }