From 64434277c5fd7c352fb86f173622520623187b7b Mon Sep 17 00:00:00 2001 From: Daniel Poelzleithner Date: Mon, 23 Sep 2019 14:43:56 +0200 Subject: [PATCH] Properly wrap LV2 searchpath on nix builds For LV2 plugins to be visible, they need to be in the LV2 search path. This patch allows a list of lv2 plugins to be passed as well as a flag to enable a default list of plugins. To enable the default list, you can build with: nix-build --arg defaultLv2Plugins true --- default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 1b674e00416c..165206dc65ea 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,7 @@ -{ nixroot ? (import {}) }: +{ nixroot ? (import {}) +, defaultLv2Plugins ? false +, lv2Plugins ? [] +}: let inherit (nixroot) stdenv pkgs lib chromaprint fftw flac libid3tag libmad libopus libshout libsndfile lilv libusb1 libvorbis libebur128 pkgconfig portaudio portmidi protobuf qt5 glib @@ -42,7 +45,7 @@ let inherit (nixroot) stdenv pkgs lib shell-run = nixroot.writeShellScriptBin "run" '' BUILDDIR=$(ls -1 -d -t lin64_build lin_build | head -1) - $BUILDDIR/mixxx --settingsPath ./devsettings/ --resourcePath ./res "$@" + /usr/bin/env LV2_PATH=${lib.makeSearchPathOutput "lib" "lib/lv2" allLv2Plugins}:$LV2_PATH $BUILDDIR/mixxx --settingsPath ./devsettings/ --resourcePath ./res "$@" ''; shell-debug = nixroot.writeShellScriptBin "debug" '' @@ -50,6 +53,11 @@ let inherit (nixroot) stdenv pkgs lib gdb --args $BUILDDIR/mixxx --settingsPath ./devsettings/ --resourcePath ./res "$@" ''; + allLv2Plugins = lv2Plugins ++ (if defaultLv2Plugins then [ + nixroot.x42-plugins nixroot.zam-plugins nixroot.rkrlv2 nixroot.mod-distortion + nixroot.infamousPlugins nixroot.artyFX + ] else []); + in stdenv.mkDerivation rec { name = "mixxx-${version}"; # reading the version from git output is very hard to do without wasting lots of diskspace and runtime @@ -83,7 +91,7 @@ in stdenv.mkDerivation rec { libusb1 libvorbis libebur128 pkgconfig portaudio portmidi protobuf qt5.full rubberband scons sqlite taglib soundtouch vamp.vampSDK opusfile upower hidapi ccache git glib x11 libGLU lilv lame lv2 makeWrapper qt5.qtbase - ]; + ] ++ allLv2Plugins; sconsFlags = [ "build=debug" @@ -102,7 +110,7 @@ in stdenv.mkDerivation rec { installPhase = '' runHook preInstall scons $sconsFlags "prefix=$out" install - wrapProgram $out/bin/mixxx --suffix QT_PLUGIN_PATH : ${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix} --set QTDIR ${qt5.full} + wrapProgram $out/bin/mixxx --suffix QT_PLUGIN_PATH : ${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix} --set QTDIR ${qt5.full} --prefix LV2_PATH : ${lib.makeSearchPath "lib/lv2" allLv2Plugins} runHook postInstall '';