about summary refs log tree commit diff
path: root/pkgs/tools/audio
diff options
context:
space:
mode:
authorKira Bruneau <kira.bruneau@pm.me>2021-04-20 16:08:20 -0400
committerKira Bruneau <kira.bruneau@pm.me>2021-04-27 15:27:47 -0400
commit9cbe07c1b24423cdba9fa239a0e2a0687877c1de (patch)
tree44975dd83dd708a5009712dbc50550f9d17347f5 /pkgs/tools/audio
parent79cb2cb9869d7bb8a1fac800977d3864212fd97d (diff)
downloadnixlib-9cbe07c1b24423cdba9fa239a0e2a0687877c1de.tar
nixlib-9cbe07c1b24423cdba9fa239a0e2a0687877c1de.tar.gz
nixlib-9cbe07c1b24423cdba9fa239a0e2a0687877c1de.tar.bz2
nixlib-9cbe07c1b24423cdba9fa239a0e2a0687877c1de.tar.lz
nixlib-9cbe07c1b24423cdba9fa239a0e2a0687877c1de.tar.xz
nixlib-9cbe07c1b24423cdba9fa239a0e2a0687877c1de.tar.zst
nixlib-9cbe07c1b24423cdba9fa239a0e2a0687877c1de.zip
yabridge, yabridgectl: hard code wine path
Diffstat (limited to 'pkgs/tools/audio')
-rw-r--r--pkgs/tools/audio/yabridge/default.nix28
-rw-r--r--pkgs/tools/audio/yabridge/hardcode-wine.patch13
-rw-r--r--pkgs/tools/audio/yabridgectl/default.nix14
3 files changed, 54 insertions, 1 deletions
diff --git a/pkgs/tools/audio/yabridge/default.nix b/pkgs/tools/audio/yabridge/default.nix
index c09045bdb6e4..d8ddf3ee5617 100644
--- a/pkgs/tools/audio/yabridge/default.nix
+++ b/pkgs/tools/audio/yabridge/default.nix
@@ -1,6 +1,8 @@
 { lib
 , stdenv
 , fetchFromGitHub
+, fetchpatch
+, substituteAll
 , meson
 , ninja
 , pkg-config
@@ -77,6 +79,24 @@ in stdenv.mkDerivation rec {
     cp -R --no-preserve=mode,ownership ${vst3.src} vst3
   )'';
 
+  patches = [
+    # Fix printing wine version when using absolute path (remove patches in next release):
+    (fetchpatch {
+      url = "https://github.com/robbert-vdh/yabridge/commit/2aadf5256b3eafeb86efa8626247972dd33baa13.patch";
+      sha256 = "sha256-Nq9TQJxa22vJLmf+USyPBkF8cKyEzb1Lp2Rx86pDxnY=";
+    })
+    (fetchpatch {
+      url = "https://github.com/robbert-vdh/yabridge/commit/93df3fa1da6ffcc69a5b384ba04e3da7c5ef23ef.patch";
+      sha256 = "sha256-//8Dxolqe6n+aFo4yVnnMR9kSq/iEFE0qZPvcIBehvI=";
+    })
+
+    # Hard code wine path so wine version is correct in logs
+    (substituteAll {
+      src = ./hardcode-wine.patch;
+      inherit wine;
+    })
+  ];
+
   postPatch = ''
     patchShebangs .
   '';
@@ -117,6 +137,14 @@ in stdenv.mkDerivation rec {
     cp libyabridge-vst3.so "$out/lib"
   '';
 
+  # Hard code wine path in wrapper scripts generated by winegcc
+  postFixup = ''
+    for exe in "$out"/bin/*.exe; do
+      substituteInPlace "$exe" \
+        --replace 'WINELOADER="wine"' 'WINELOADER="${wine}/bin/wine"'
+    done
+  '';
+
   meta = with lib; {
     description = "Yet Another VST bridge, run Windows VST2 plugins under Linux";
     homepage = "https://github.com/robbert-vdh/yabridge";
diff --git a/pkgs/tools/audio/yabridge/hardcode-wine.patch b/pkgs/tools/audio/yabridge/hardcode-wine.patch
new file mode 100644
index 000000000000..2b6ce1f448fa
--- /dev/null
+++ b/pkgs/tools/audio/yabridge/hardcode-wine.patch
@@ -0,0 +1,13 @@
+diff --git a/src/plugin/utils.cpp b/src/plugin/utils.cpp
+index 1ff05bc..0723456 100644
+--- a/src/plugin/utils.cpp
++++ b/src/plugin/utils.cpp
+@@ -351,7 +351,7 @@ std::string get_wine_version() {
+         access(wineloader_path.c_str(), X_OK) == 0) {
+         wine_path = wineloader_path;
+     } else {
+-        wine_path = bp::search_path("wine").string();
++        wine_path = "@wine@/bin/wine";
+     }
+ 
+     bp::ipstream output;
diff --git a/pkgs/tools/audio/yabridgectl/default.nix b/pkgs/tools/audio/yabridgectl/default.nix
index 4548b288b690..2cbaf3f4ad5a 100644
--- a/pkgs/tools/audio/yabridgectl/default.nix
+++ b/pkgs/tools/audio/yabridgectl/default.nix
@@ -1,4 +1,9 @@
-{ lib, rustPlatform, yabridge }:
+{ lib
+, rustPlatform
+, yabridge
+, makeWrapper
+, wine
+}:
 
 rustPlatform.buildRustPackage rec {
   pname = "yabridgectl";
@@ -17,6 +22,13 @@ rustPlatform.buildRustPackage rec {
 
   patchFlags = [ "-p3" ];
 
+  nativeBuildInputs = [ makeWrapper ];
+
+  postFixup = ''
+    wrapProgram "$out/bin/yabridgectl" \
+      --prefix PATH : ${lib.makeBinPath [ wine ]}
+  '';
+
   meta = with lib; {
     description = "A small, optional utility to help set up and update yabridge for several directories at once";
     homepage = "https://github.com/robbert-vdh/yabridge/tree/master/tools/yabridgectl";