about summary refs log tree commit diff
path: root/pkgs/applications/audio/dexed
diff options
context:
space:
mode:
authorOPNA2608 <christoph.neidahl@gmail.com>2022-08-18 14:38:57 +0200
committerOPNA2608 <christoph.neidahl@gmail.com>2022-08-18 14:38:57 +0200
commit63ad6465b1427b3f30327e19fef05cdb2c9fd6a8 (patch)
tree066b294a5abc837f149b6aed543db8818981eba5 /pkgs/applications/audio/dexed
parent1ee067092785512e63d50d1ce9c3dc1ea43894a0 (diff)
dexed: init at unstable-2022-07-09
Needs at least 10.14 SDK on Darwin, so we need to switch to the 11.0 one.

https://github.com/juce-framework/JUCE/blob/b08520c2de1771af3dfcbfbc0e0b6b0b5eb083b0/modules/juce_core/system/juce_TargetPlatform.h#L147-L148
Diffstat (limited to 'pkgs/applications/audio/dexed')
-rw-r--r--pkgs/applications/audio/dexed/default.nix107
1 files changed, 107 insertions, 0 deletions
diff --git a/pkgs/applications/audio/dexed/default.nix b/pkgs/applications/audio/dexed/default.nix
new file mode 100644
index 0000000000000..67d9a56a1d0c5
--- /dev/null
+++ b/pkgs/applications/audio/dexed/default.nix
@@ -0,0 +1,107 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, cmake
+, pkg-config
+, libX11
+, libXrandr
+, libXinerama
+, libXext
+, libXcursor
+, freetype
+, alsa-lib
+, libjack2
+, Cocoa
+, WebKit
+, MetalKit
+, simd
+, DiscRecording
+, CoreAudioKit
+}:
+
+stdenv.mkDerivation rec {
+  pname = "dexed";
+  version = "unstable-2022-07-09";
+
+  src = fetchFromGitHub {
+    owner = "asb2m10";
+    repo = "dexed";
+    rev = "2c036316bcd512818aa9cc8129767ad9e0ec7132";
+    fetchSubmodules = true;
+    sha256 = "sha256-6buvA72YRlGjHWLPEZMr45lYYG6ZY+IWmylcHruX27g=";
+  };
+
+  postPatch = ''
+    # needs special setup on Linux, dunno if it can work on Darwin
+    # https://github.com/NixOS/nixpkgs/issues/19098
+    sed -i -e '/juce::juce_recommended_lto_flags/d' Source/CMakeLists.txt
+  '';
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
+
+  buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
+    libX11
+    libXext
+    libXcursor
+    libXinerama
+    libXrandr
+    freetype
+    alsa-lib
+    libjack2
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+    Cocoa
+    WebKit
+    MetalKit
+    simd
+    DiscRecording
+    CoreAudioKit
+  ];
+
+  # JUCE insists on only dlopen'ing these
+  NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isLinux (toString [
+    "-lX11"
+    "-lXext"
+    "-lXcursor"
+    "-lXinerama"
+    "-lXrandr"
+    "-ljack"
+  ]);
+
+  installPhase = let
+    vst3Dir = if stdenv.hostPlatform.isDarwin then "$out/Library/Audio/Plug-Ins/VST3" else "$out/lib/vst3";
+    # this one's a guess, don't know where ppl have agreed to put them yet
+    clapDir = if stdenv.hostPlatform.isDarwin then "$out/Library/Audio/Plug-Ins/CLAP" else "$out/lib/clap";
+    auDir = "$out/Library/Audio/Plug-Ins/Components";
+  in ''
+    runHook preInstall
+
+  '' + (if stdenv.hostPlatform.isDarwin then ''
+    mkdir -p $out/{Applications,bin}
+    mv Source/Dexed_artefacts/Release/Standalone/Dexed.app $out/Applications/
+    ln -s $out/{Applications/Dexed.app/Contents/MacOS,bin}/Dexed
+  '' else ''
+    install -Dm755 {Source/Dexed_artefacts/Release/Standalone,$out/bin}/Dexed
+  '') + ''
+    mkdir -p ${vst3Dir} ${clapDir}
+    mv Source/Dexed_artefacts/Release/VST3/* ${vst3Dir}
+    mv Source/Dexed_artefacts/Release/CLAP/* ${clapDir}
+  '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
+    mkdir -p ${auDir}
+    mv Source/Dexed_artefacts/Release/AU/* ${auDir}
+  '' + ''
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "DX7 FM multi platform/multi format plugin";
+    mainProgram = "Dexed";
+    homepage = "https://asb2m10.github.io/dexed";
+    license = licenses.gpl3Only;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ OPNA2608 ];
+  };
+}