summary refs log tree commit diff
path: root/pkgs/applications/audio/surge-XT
diff options
context:
space:
mode:
authorBart Brouns <bart@magnetophon.nl>2021-12-08 01:06:56 +0100
committerBart Brouns <bart@magnetophon.nl>2021-12-12 11:12:07 +0100
commit65e4745989cc29314caec1548cf7a0923991f39b (patch)
tree74a94e48145fe41309a332feadbfce775512658b /pkgs/applications/audio/surge-XT
parentfeb86343bd4227403b5793de5ed76015ff1bc341 (diff)
downloadnixpkgs-65e4745989cc29314caec1548cf7a0923991f39b.tar
nixpkgs-65e4745989cc29314caec1548cf7a0923991f39b.tar.gz
nixpkgs-65e4745989cc29314caec1548cf7a0923991f39b.tar.bz2
nixpkgs-65e4745989cc29314caec1548cf7a0923991f39b.tar.lz
nixpkgs-65e4745989cc29314caec1548cf7a0923991f39b.tar.xz
nixpkgs-65e4745989cc29314caec1548cf7a0923991f39b.tar.zst
nixpkgs-65e4745989cc29314caec1548cf7a0923991f39b.zip
Surge-XT: unstable-2021-11-07 -> unstable-2021-12-11
surge-XT: fix crashing

update version, make sure it doesn't try to write to home.

update juce-lv2 version number
Diffstat (limited to 'pkgs/applications/audio/surge-XT')
-rw-r--r--pkgs/applications/audio/surge-XT/default.nix82
1 files changed, 71 insertions, 11 deletions
diff --git a/pkgs/applications/audio/surge-XT/default.nix b/pkgs/applications/audio/surge-XT/default.nix
index 6445723d778..a08c25f016a 100644
--- a/pkgs/applications/audio/surge-XT/default.nix
+++ b/pkgs/applications/audio/surge-XT/default.nix
@@ -1,27 +1,87 @@
-{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, cairo, libxkbcommon, xcbutilcursor, xcbutilkeysyms, xcbutil, libXrandr, libXinerama, libXcursor, alsa-lib, libjack2
+{ stdenv
+, lib
+, fetchFromGitHub
+, cmake
+, pkg-config
+, alsa-lib
+, freetype
+, libjack2
+, lv2
+, libX11
+, libXcursor
+, libXext
+, libXinerama
+, libXrandr
 }:
 
+let
+  juce-lv2 = stdenv.mkDerivation {
+    pname = "juce-lv2";
+    version = "unstable-2021-12-11";
+
+    # lv2 branch
+    src = fetchFromGitHub {
+      owner = "lv2-porting-project";
+      repo = "JUCE";
+      rev = "5106d9d77b892c22afcb9379c13982f270429e2e";
+      sha256 = "sha256-bpZJ5NEDRfMtmx0RkKQFZWqS/SnYAFRhrDg9MSphh4c=";
+    };
+
+    dontConfigure = true;
+    dontBuild = true;
+
+    installPhase = ''
+      cp -r . $out
+    '';
+  };
+in
 stdenv.mkDerivation rec {
   pname = "surge-XT";
-  version = "unstable-2021-11-07";
+  version = "unstable-2021-12-11";
 
   src = fetchFromGitHub {
     owner = "surge-synthesizer";
     repo = "surge";
-    rev = "ed93833eb44b177c977e3a7b878ffdd9bf9f24e5";
-    sha256 = "0b164659ksl6h5nn7jja5zccx2mwzibqs6b7hg8l98gpcy9fi5r2";
+    rev = "320f68543d0279c11cea8dc7f5170399cccc9602";
     fetchSubmodules = true;
+    sha256 = "sha256-Jcs5FpX5AZl72aKYNbRcfYqb2PRt0r1pQXk957xk0aM=";
   };
 
-  nativeBuildInputs = [ cmake pkg-config ];
-  buildInputs = [ cairo libxkbcommon xcbutilcursor xcbutilkeysyms xcbutil libXrandr libXinerama libXcursor alsa-lib libjack2 ];
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
 
-  installPhase = ''
-    cd ..
-    cmake --build build --config Release --target install
-  '';
+  buildInputs = [
+    alsa-lib
+    freetype
+    libjack2
+    lv2
+    libX11
+    libXcursor
+    libXext
+    libXinerama
+    libXrandr
+  ];
+
+  cmakeFlags = [
+    "-DJUCE_SUPPORTS_LV2=ON"
+    "-DSURGE_JUCE_PATH=${juce-lv2}"
+  ];
 
-  doInstallCheck = false;
+  # JUCE dlopen's these at runtime, crashes without them
+  NIX_LDFLAGS = (toString [
+    "-lX11"
+    "-lXext"
+    "-lXcursor"
+    "-lXinerama"
+    "-lXrandr"
+  ]);
+
+  # see https://github.com/NixOS/nixpkgs/pull/149487#issuecomment-991747333
+  postPatch = ''
+    export XDG_DOCUMENTS_DIR=$(mktemp -d)
+  '';
 
   meta = with lib; {
     description = "LV2 & VST3 synthesizer plug-in (previously released as Vember Audio Surge)";