From 5dc41a81aad556d59005d86820dd143f1337de03 Mon Sep 17 00:00:00 2001 From: Daniel Poelzleithner Date: Thu, 10 Sep 2020 23:05:54 +0200 Subject: [PATCH 1/2] Fix LV2 wrapper The LV2 environment variable is required for the subsystem to find the enabled plugins. --- shell.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/shell.nix b/shell.nix index 615af4d1d3c..b99e1c39d7f 100644 --- a/shell.nix +++ b/shell.nix @@ -7,7 +7,8 @@ let inherit (nixroot) stdenv pkgs lib chromaprint fftw flac libid3tag libmad libopus libshout libsndfile lilv libusb1 libvorbis libebur128 pkgconfig portaudio portmidi protobuf qt5 glib rubberband sqlite taglib soundtouch vamp opusfile hidapi upower ccache git - libGLU x11 lame lv2 makeWrapper + libGLU x11 lame lv2 makeWrapper pcre utillinux libselinux libsepol + libsForQt5 clang-tools cmake fetchurl @@ -57,6 +58,8 @@ let inherit (nixroot) stdenv pkgs lib fi cd cbuild cmake --build . --parallel $NIX_BUILD_CORES "$@" + source ${pkgs.makeWrapper}/nix-support/setup-hook + wrapProgram mixxx --prefix LV2_PATH : ${lib.makeSearchPath "lib/lv2" allLv2Plugins} ''; shell-run = nixroot.writeShellScriptBin "run" '' @@ -74,7 +77,7 @@ let inherit (nixroot) stdenv pkgs lib exit 1 fi cd cbuild - gdb --args ./mixxx --resourcePath res/ "$@" + LV2_PATH=${lib.makeSearchPath "lib/lv2" allLv2Plugins} gdb --args ./.mixxx-wrapped --resourcePath res/ "$@" ''; allLv2Plugins = lv2Plugins ++ (if defaultLv2Plugins then [ @@ -118,13 +121,18 @@ in stdenv.mkDerivation rec { chromaprint fftw flac libid3tag libmad libopus libshout libsndfile libusb1 libvorbis libebur128 pkgconfig portaudio portmidi protobuf qt5.full rubberband sqlite taglib soundtouch vamp.vampSDK opusfile upower hidapi - git glib x11 libGLU lilv lame lv2 makeWrapper qt5.qtbase + git glib x11 libGLU lilv lame lv2 makeWrapper qt5.qtbase pcre utillinux libselinux + libsepol libsForQt5.qtkeychain ffmpeg libmodplug mp4v2 wavpack ] ++ allLv2Plugins; + postBuild = '' + wrapProgram mixxx --prefix LV2_PATH : ${lib.makeSearchPath "lib/lv2" allLv2Plugins} + ''; + meta = with nixroot.stdenv.lib; { homepage = https://mixxx.org; description = "Digital DJ mixing software"; From 6af7b84e4c49b369838949ccbc1fbe703e13afc7 Mon Sep 17 00:00:00 2001 From: Daniel Poelzleithner Date: Sat, 10 Oct 2020 00:41:41 +0200 Subject: [PATCH 2/2] Install wrapper only when necesarry. Install dependencies for pre-commit hock and ensure pre-commit is properly installed when using nix-shell --- shell.nix | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/shell.nix b/shell.nix index b99e1c39d7f..5e5168f4a26 100644 --- a/shell.nix +++ b/shell.nix @@ -17,7 +17,7 @@ let inherit (nixroot) stdenv pkgs lib libmodplug mp4v2 nix-gitignore - python3 + python3 python37Packages wavpack; git-clang-format = stdenv.mkDerivation { @@ -49,6 +49,12 @@ let inherit (nixroot) stdenv pkgs lib mkdir -p cbuild cd cbuild cmake .. "$@" + cd .. + if [ ! -e venv/bin/pre-commit ]; then + virtualenv -p python3 venv + ./venv/bin/pip install pre-commit + ./venv/bin/pre-commit install + fi ''; shell-build = nixroot.writeShellScriptBin "build" '' @@ -93,7 +99,10 @@ in stdenv.mkDerivation rec { lib.strings.removePrefix "#define MIXXX_VERSION \"" ( builtins.readFile ./src/_version.h )); + # SOURCE_DATE_EPOCH helps with python and pre-commit hook shellHook = '' + export PYTHONPATH=venv/lib/python3.7/site-packages/:$PYTHONPATH + export SOURCE_DATE_EPOCH=315532800 echo -e "Mixxx development shell. Available commands:\n" echo " configure - configures cmake (only has to run once)" echo " build - compiles Mixxx" @@ -106,6 +115,7 @@ in stdenv.mkDerivation rec { /.envrc /result /shell.nix + /venv '' ./.) else null; nativeBuildInputs = [ @@ -114,6 +124,9 @@ in stdenv.mkDerivation rec { ccache gdb git-clang-format + clang-tools + # for pre-commit installation since nixpkg.pre-commit may be to old + python3 python37Packages.virtualenv python37Packages.pip python37Packages.setuptools shell-configure shell-build shell-run shell-debug ] else []); @@ -129,9 +142,9 @@ in stdenv.mkDerivation rec { wavpack ] ++ allLv2Plugins; - postBuild = '' - wrapProgram mixxx --prefix LV2_PATH : ${lib.makeSearchPath "lib/lv2" allLv2Plugins} - ''; + postInstall = (if releaseMode then '' + wrapProgram $out/bin/mixxx --prefix LV2_PATH : ${lib.makeSearchPath "lib/lv2" allLv2Plugins} + '' else ""); meta = with nixroot.stdenv.lib; { homepage = https://mixxx.org;