From 3af97fc9ee54f7e5fff7fea4043dfd533c13cfed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sat, 5 Aug 2023 09:23:43 +0200 Subject: [PATCH] treewide: amend hacks of removing $(pwd) The strip phase is using $TMPDIR now, so it would fail with: mktemp: failed to create file via template 'striperr.XXXXXX': No such file or directory --- pkgs/development/compilers/bigloo/default.nix | 10 ++++++++-- pkgs/development/libraries/accounts-qt/default.nix | 4 ++-- pkgs/development/libraries/libdwg/default.nix | 10 ++++++++-- pkgs/development/libraries/libftdi/default.nix | 11 +++++++++-- pkgs/games/klavaro/default.nix | 10 ++++++++-- pkgs/tools/security/ssdeep/default.nix | 6 ++++-- 6 files changed, 39 insertions(+), 12 deletions(-) diff --git a/pkgs/development/compilers/bigloo/default.nix b/pkgs/development/compilers/bigloo/default.nix index 759a8aaeaa60..9bf22ba6dcf2 100644 --- a/pkgs/development/compilers/bigloo/default.nix +++ b/pkgs/development/compilers/bigloo/default.nix @@ -45,8 +45,14 @@ stdenv.mkDerivation rec { checkTarget = "test"; - # Hack to avoid TMPDIR in RPATHs. - preFixup = ''rm -rf "$(pwd)" ''; + # remove forbidden references to $TMPDIR + preFixup = lib.optionalString stdenv.isLinux '' + for f in "$out"/bin/*; do + if isELF "$f"; then + patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$f" + fi + done + ''; meta = { description = "Efficient Scheme compiler"; diff --git a/pkgs/development/libraries/accounts-qt/default.nix b/pkgs/development/libraries/accounts-qt/default.nix index 2b5baebf10dc..93f33531b5e8 100644 --- a/pkgs/development/libraries/accounts-qt/default.nix +++ b/pkgs/development/libraries/accounts-qt/default.nix @@ -14,9 +14,9 @@ mkDerivation rec { propagatedBuildInputs = [ glib libaccounts-glib ]; nativeBuildInputs = [ doxygen pkg-config qmake ]; - # remove forbidden reference to $TMPDIR + # remove forbidden references to $TMPDIR preFixup = '' - patchelf --shrink-rpath --allowed-rpath-prefixes "/nix/store" "$out"/bin/* + patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$out"/bin/* ''; meta = with lib; { diff --git a/pkgs/development/libraries/libdwg/default.nix b/pkgs/development/libraries/libdwg/default.nix index 37eeb73f91cd..969b5d9636f2 100644 --- a/pkgs/development/libraries/libdwg/default.nix +++ b/pkgs/development/libraries/libdwg/default.nix @@ -13,8 +13,14 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" ]; - # Hack to avoid TMPDIR in RPATHs. - preFixup = ''rm -rf "$(pwd)" ''; + # remove forbidden references to $TMPDIR + preFixup = lib.optionalString stdenv.isLinux '' + for f in "$out"/bin/*; do + if isELF "$f"; then + patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$f" + fi + done + ''; meta = { description = "Library reading dwg files"; diff --git a/pkgs/development/libraries/libftdi/default.nix b/pkgs/development/libraries/libftdi/default.nix index d177f7369a04..ffc33d0247d1 100644 --- a/pkgs/development/libraries/libftdi/default.nix +++ b/pkgs/development/libraries/libftdi/default.nix @@ -20,8 +20,6 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ libusb-compat-0_1 ]; - # Hack to avoid TMPDIR in RPATHs. - preFixup = ''rm -rf "$(pwd)" ''; configureFlags = lib.optional (!stdenv.isDarwin) "--with-async-mode"; # allow async mode. from ubuntu. see: @@ -31,6 +29,15 @@ stdenv.mkDerivation rec { --replace "ifdef USB_CLASS_PTP" "if 0" ''; + # remove forbidden references to $TMPDIR + preFixup = lib.optionalString stdenv.isLinux '' + for f in "$out"/bin/*; do + if isELF "$f"; then + patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$f" + fi + done + ''; + meta = { description = "A library to talk to FTDI chips using libusb"; homepage = "https://www.intra2net.com/en/developer/libftdi/"; diff --git a/pkgs/games/klavaro/default.nix b/pkgs/games/klavaro/default.nix index 6ea029176482..79585e74a095 100644 --- a/pkgs/games/klavaro/default.nix +++ b/pkgs/games/klavaro/default.nix @@ -39,8 +39,14 @@ stdenv.mkDerivation rec { --replace "/usr/bin/file" "${file}/bin/file" ''; - # Hack to avoid TMPDIR in RPATHs. - preFixup = ''rm -rf "$(pwd)" ''; + # remove forbidden references to $TMPDIR + preFixup = lib.optionalString stdenv.isLinux '' + for f in "$out"/bin/*; do + if isELF "$f"; then + patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$f" + fi + done + ''; meta = with lib; { description = "Free touch typing tutor program"; diff --git a/pkgs/tools/security/ssdeep/default.nix b/pkgs/tools/security/ssdeep/default.nix index acc617103d71..7647246369ff 100644 --- a/pkgs/tools/security/ssdeep/default.nix +++ b/pkgs/tools/security/ssdeep/default.nix @@ -13,8 +13,10 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook ]; - # Hack to avoid TMPDIR in RPATHs. - preFixup = ''rm -rf "$(pwd)" ''; + # remove forbidden references to $TMPDIR + preFixup = lib.optionalString stdenv.isLinux '' + patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$out"/bin/* + ''; meta = { description = "A program for calculating fuzzy hashes";