nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 faust,
3 alsa-lib,
4 qt5,
5 writeText,
6 buildPackages,
7}:
8let
9 # Wrap the binary coming out of the the compilation script, so it knows QT_PLUGIN_PATH
10 wrapBinary = writeText "wrapBinary" ''
11 source ${buildPackages.makeWrapper}/nix-support/setup-hook
12 for p in $FILES; do
13 workpath=$PWD
14 cd -- "$(dirname "$p")"
15 binary=$(basename --suffix=.dsp "$p")
16 rm -f .$binary-wrapped
17 wrapProgram $binary --set QT_PLUGIN_PATH "${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}"
18 sed -i $binary -e 's@exec@cd "$(dirname "$(readlink -f "''${BASH_SOURCE[0]}")")" \&\& exec@g'
19 cd $workpath
20 done
21 '';
22in
23faust.wrapWithBuildEnv {
24
25 baseName = "faust2alqt";
26
27 propagatedBuildInputs = [
28 alsa-lib
29 qt5.qtbase
30 ];
31
32 dontWrapQtApps = true;
33
34 preFixup = ''
35 for script in "$out"/bin/*; do
36 # append the wrapping code to the compilation script
37 cat ${wrapBinary} >> $script
38 # prevent the qmake error when running the script
39 sed -i "/QMAKE=/c\ QMAKE="${qt5.qtbase.dev}/bin/qmake"" $script
40 done
41 '';
42}