wrapGAppsHook: use makeBinaryWrapper

Reduces the likelihood of having apps wrapped twice by a shell script,
which causes problems with argv0.
main
Naïm Favier 2 years ago
parent 4586388f85
commit 532ebf6b57
No known key found for this signature in database
GPG Key ID: 49B07322580B7EE2
  1. 6
      pkgs/applications/editors/vim/configurable.nix
  2. 20
      pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix
  3. 13
      pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.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 = [

@ -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"}
'';
};
};

@ -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
'';
}

Loading…
Cancel
Save