Skip to content

Commit

Permalink
Properly wrap LV2 searchpath on nix builds
Browse files Browse the repository at this point in the history
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
  • Loading branch information
poelzi committed Sep 23, 2019
1 parent a7ae01d commit 6443427
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{ nixroot ? (import <nixpkgs> {}) }:
{ nixroot ? (import <nixpkgs> {})
, 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
Expand Down Expand Up @@ -42,14 +45,19 @@ 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" ''
BUILDDIR=$(ls -1 -d -t lin64_build lin_build | head -1)
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
Expand Down Expand Up @@ -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"
Expand All @@ -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
'';

Expand Down

0 comments on commit 6443427

Please sign in to comment.