forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.nix
124 lines (109 loc) · 4 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{ 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
rubberband scons sqlite taglib soundtouch vamp opusfile hidapi upower ccache git
libGLU x11 lame lv2 makeWrapper
clang-tools
fetchurl
gdb
python3;
git-clang-format = stdenv.mkDerivation {
name = "git-clang-format";
version = "2019-06-21";
src = fetchurl {
url = "https://raw.githubusercontent.com/llvm-mirror/clang/2bb8e0fe002e8ffaa9ce5fa58034453c94c7e208/tools/clang-format/git-clang-format";
sha256 = "1kby36i80js6rwi11v3ny4bqsi6i44b9yzs23pdcn9wswffx1nlf";
executable = true;
};
nativeBuildInputs = [
makeWrapper
];
buildInputs = [
clang-tools
python3
];
unpackPhase = ":";
installPhase = ''
mkdir -p $out/opt $out/bin
cp $src $out/opt/git-clang-format
makeWrapper $out/opt/git-clang-format $out/bin/git-clang-format \
--add-flags --binary \
--add-flags ${clang-tools}/bin/clang-format
'';
};
shell-build = nixroot.writeShellScriptBin "build" ''
scons \
-j$NIX_BUILD_CORES \
$sconsFlags "prefix=$HOME/mixxx" "$@";
'';
shell-run = nixroot.writeShellScriptBin "run" ''
BUILDDIR=$(ls -1 -d -t lin64_build lin_build | head -1)
/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
# reading version file is easy
version = lib.strings.removeSuffix "\"\n" (
lib.strings.removePrefix "#define MIXXX_VERSION \"" (
builtins.readFile ./src/_version.h ));
shellHook = ''
export CC="ccache gcc"
export CXX="ccache g++"
echo -e "Mixxx development shell. Available commands:\n"
echo " build - compiles Mixxx"
echo " run - runs Mixxx with development settings"
echo " debug - runs Mixxx inside gdb"
'';
src = builtins.filterSource
(path: type: ! builtins.any (x: x == baseNameOf path) [ ".git" "cache" "lin64_build" "lin_build" "debian" ])
./.;
nativeBuildInputs = [
gdb
git-clang-format
shell-build shell-run shell-debug
];
buildInputs = [
chromaprint fftw flac libid3tag libmad libopus libshout libsndfile
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"
"qtdir=${qt5.full}"
];
buildPhase = ''
runHook preBuild;
mkdir -p "$out";
scons \
-j$NIX_BUILD_CORES \
$sconsFlags "prefix=$out";
runHook postBuild
'';
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} --prefix LV2_PATH : ${lib.makeSearchPath "lib/lv2" allLv2Plugins}
runHook postInstall
'';
meta = with nixroot.stdenv.lib; {
homepage = https://mixxx.org;
description = "Digital DJ mixing software";
license = licenses.gpl2Plus;
maintainers = [ maintainers.aszlig maintainers.goibhniu ];
platforms = platforms.linux;
};
}