From 62245943aa12a06cc976ca94c632d70049316415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 10 May 2022 16:01:59 +0200 Subject: [PATCH] makeWrapper,makeBinaryWrapper: introduce explicitly named functions Because both versions might end up in a derivation's build inputs, it might be useful to be able to explicitly select which function to use. --- .../networking/instant-messengers/discord/linux.nix | 5 +++-- pkgs/applications/science/logic/tlaplus/toolbox.nix | 4 ++-- .../setup-hooks/make-binary-wrapper/make-binary-wrapper.sh | 6 ++++-- pkgs/build-support/setup-hooks/make-wrapper.sh | 6 ++++-- pkgs/tools/security/cryptomator/default.nix | 4 ++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/discord/linux.nix b/pkgs/applications/networking/instant-messengers/discord/linux.nix index f5d984bf3a6..b36dc935f1c 100644 --- a/pkgs/applications/networking/instant-messengers/discord/linux.nix +++ b/pkgs/applications/networking/instant-messengers/discord/linux.nix @@ -24,7 +24,8 @@ stdenv.mkDerivation rec { libxshmfence mesa nss - (wrapGAppsHook.override { makeBinaryWrapper = makeWrapper; }) + wrapGAppsHook + makeWrapper ]; dontWrapGApps = true; @@ -78,7 +79,7 @@ stdenv.mkDerivation rec { patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \ $out/opt/${binaryName}/${binaryName} - wrapProgram $out/opt/${binaryName}/${binaryName} \ + wrapProgramShell $out/opt/${binaryName}/${binaryName} \ "''${gappsWrapperArgs[@]}" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}" \ --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \ diff --git a/pkgs/applications/science/logic/tlaplus/toolbox.nix b/pkgs/applications/science/logic/tlaplus/toolbox.nix index d84f0b2abf6..ff763608cba 100644 --- a/pkgs/applications/science/logic/tlaplus/toolbox.nix +++ b/pkgs/applications/science/logic/tlaplus/toolbox.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ makeWrapper - (wrapGAppsHook.override { makeBinaryWrapper = makeWrapper; }) + wrapGAppsHook ]; dontWrapGApps = true; @@ -64,7 +64,7 @@ stdenv.mkDerivation rec { --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ "$(find "$out/toolbox" -name jspawnhelper)" - makeWrapper $out/toolbox/toolbox $out/bin/tla-toolbox \ + makeShellWrapper $out/toolbox/toolbox $out/bin/tla-toolbox \ --chdir "$out/toolbox" \ --add-flags "-data ~/.tla-toolbox" \ --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ gtk3 libXtst glib zlib ]}" \ diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh index abcde2429ee..9496c918580 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh @@ -32,7 +32,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() { +makeWrapper() { makeBinaryWrapper "$@"; } +makeBinaryWrapper() { local NIX_CFLAGS_COMPILE= NIX_CFLAGS_LINK= local original="$1" local wrapper="$2" @@ -52,7 +53,8 @@ makeWrapper() { } # Syntax: wrapProgram -wrapProgram() { +wrapProgram() { wrapProgramBinary "$@"; } +wrapProgramBinary() { local prog="$1" local hidden diff --git a/pkgs/build-support/setup-hooks/make-wrapper.sh b/pkgs/build-support/setup-hooks/make-wrapper.sh index 7d598956168..c6188c2cd96 100644 --- a/pkgs/build-support/setup-hooks/make-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-wrapper.sh @@ -29,7 +29,8 @@ assertExecutable() { # --prefix-contents ENV SEP FILES : like --suffix-each, but contents of FILES # are read first and used as VALS # --suffix-contents -makeWrapper() { +makeWrapper() { makeShellWrapper "$@"; } +makeShellWrapper() { local original="$1" local wrapper="$2" local params varName value command separator n fileNames @@ -193,7 +194,8 @@ filterExisting() { } # Syntax: wrapProgram -wrapProgram() { +wrapProgram() { wrapProgramShell "$@"; } +wrapProgramShell() { local prog="$1" local hidden diff --git a/pkgs/tools/security/cryptomator/default.nix b/pkgs/tools/security/cryptomator/default.nix index 5a1886e49e5..9517427fefd 100644 --- a/pkgs/tools/security/cryptomator/default.nix +++ b/pkgs/tools/security/cryptomator/default.nix @@ -65,7 +65,7 @@ in stdenv.mkDerivation rec { rm $out/share/cryptomator/libs/jff*.jar cp -f ${jffi}/share/java/jffi-complete.jar $out/share/cryptomator/libs/ - makeWrapper ${jre}/bin/java $out/bin/cryptomator \ + makeShellWrapper ${jre}/bin/java $out/bin/cryptomator \ --add-flags "--class-path '$out/share/cryptomator/libs/*'" \ --add-flags "--module-path '$out/share/cryptomator/mods'" \ --add-flags "-Dcryptomator.logDir='~/.local/share/Cryptomator/logs'" \ @@ -102,7 +102,7 @@ in stdenv.mkDerivation rec { autoPatchelfHook maven makeWrapper - (wrapGAppsHook.override { makeBinaryWrapper = makeWrapper; }) + wrapGAppsHook jdk ]; buildInputs = [ fuse jre glib jffi ];