From 79bab74f0ec63353f694a6bb7e2faa5630926dbf Mon Sep 17 00:00:00 2001
From: Roland Gritzer <gritzer.roland@gmail.com>
Date: Mon, 23 Aug 2021 15:50:43 +0200
Subject: [PATCH] bitwig-studio: fix gtk file dialog

Fixes: #133554
GTK file dialog was broken in 4.0.1
---
 pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix b/pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix
index 492054396702..447bc7d6635d 100644
--- a/pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix
+++ b/pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix
@@ -49,6 +49,7 @@ stdenv.mkDerivation rec {
       -not -name '*.so.*' \
       -not -name '*.so' \
       -not -name '*.jar' \
+      -not -name 'jspawnhelper' \
       -not -path '*/resources/*' | \
     while IFS= read -r f ; do
       patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $f
@@ -58,6 +59,10 @@ stdenv.mkDerivation rec {
         --suffix LD_LIBRARY_PATH : "${lib.strings.makeLibraryPath buildInputs}"
     done
 
+    find $out -type f -executable -name 'jspawnhelper' | \
+    while IFS= read -r f ; do
+      patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $f
+    done
   '';
 
   meta = with lib; {