Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 240 lines 6.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 pkg-config, 7 qt5, 8 cmake, 9 avahi, 10 boost, 11 libopus, 12 libsndfile, 13 speexdsp, 14 protobuf, 15 libcap, 16 alsa-lib, 17 python3, 18 rnnoise, 19 nixosTests, 20 poco, 21 flac, 22 libogg, 23 libvorbis, 24 stdenv_32bit, 25 alsaSupport ? stdenv.hostPlatform.isLinux, 26 iceSupport ? true, 27 zeroc-ice, 28 jackSupport ? false, 29 libjack2, 30 pipewireSupport ? stdenv.hostPlatform.isLinux, 31 pipewire, 32 pulseSupport ? true, 33 libpulseaudio, 34 speechdSupport ? false, 35 speechd-minimal, 36 microsoft-gsl, 37 nlohmann_json, 38 xar, 39 makeWrapper, 40}: 41 42let 43 generic = 44 overrides: source: 45 (overrides.stdenv or stdenv).mkDerivation ( 46 source 47 // overrides 48 // { 49 pname = overrides.type; 50 version = source.version; 51 52 nativeBuildInputs = [ 53 cmake 54 pkg-config 55 python3 56 qt5.wrapQtAppsHook 57 qt5.qttools 58 ] 59 ++ (overrides.nativeBuildInputs or [ ]); 60 61 buildInputs = [ 62 boost 63 poco 64 protobuf 65 microsoft-gsl 66 nlohmann_json 67 ] 68 ++ lib.optionals stdenv.hostPlatform.isLinux [ avahi ] 69 ++ (overrides.buildInputs or [ ]); 70 71 cmakeFlags = [ 72 "-D g15=OFF" 73 "-D CMAKE_CXX_STANDARD=17" # protobuf >22 requires C++ 17 74 "-D BUILD_NUMBER=${lib.versions.patch source.version}" 75 "-D bundled-gsl=OFF" 76 "-D bundled-json=OFF" 77 ] 78 ++ (overrides.cmakeFlags or [ ]); 79 80 preConfigure = '' 81 patchShebangs scripts 82 ''; 83 84 passthru.tests.connectivity = nixosTests.mumble; 85 86 meta = with lib; { 87 description = "Low-latency, high quality voice chat software"; 88 homepage = "https://mumble.info"; 89 license = licenses.bsd3; 90 maintainers = with maintainers; [ 91 felixsinger 92 lilacious 93 ]; 94 platforms = platforms.linux ++ (overrides.platforms or [ ]); 95 }; 96 } 97 ); 98 99 client = 100 source: 101 generic { 102 type = "mumble"; 103 104 platforms = lib.platforms.darwin; 105 nativeBuildInputs = [ 106 qt5.qttools 107 ] 108 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 109 makeWrapper 110 ]; 111 112 buildInputs = [ 113 flac 114 libogg 115 libopus 116 libsndfile 117 libvorbis 118 speexdsp 119 qt5.qtsvg 120 rnnoise 121 ] 122 ++ lib.optional (!jackSupport && alsaSupport) alsa-lib 123 ++ lib.optional jackSupport libjack2 124 ++ lib.optional speechdSupport speechd-minimal 125 ++ lib.optional pulseSupport libpulseaudio 126 ++ lib.optional pipewireSupport pipewire 127 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 128 xar 129 ]; 130 131 cmakeFlags = [ 132 "-D server=OFF" 133 "-D bundled-speex=OFF" 134 "-D bundle-qt-translations=OFF" 135 "-D update=OFF" 136 "-D overlay-xcompile=OFF" 137 "-D oss=OFF" 138 "-D warnings-as-errors=OFF" # conversion error workaround 139 # building the overlay on darwin does not work in nipxkgs (yet) 140 # also see the patch below to disable scripts the build option misses 141 # see https://github.com/mumble-voip/mumble/issues/6816 142 (lib.cmakeBool "overlay" (!stdenv.hostPlatform.isDarwin)) 143 (lib.cmakeBool "speechd" speechdSupport) 144 (lib.cmakeBool "pulseaudio" pulseSupport) 145 (lib.cmakeBool "pipewire" pipewireSupport) 146 (lib.cmakeBool "jackaudio" jackSupport) 147 (lib.cmakeBool "alsa" (!jackSupport && alsaSupport)) 148 ]; 149 150 env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd-minimal}/include/speech-dispatcher"; 151 152 patches = [ 153 ./disable-overlay-build.patch 154 ./fix-plugin-copy.patch 155 # Can be removed before the next update of Mumble, as that fix was upstreamed 156 # fix version display in MacOS Finder 157 (fetchpatch { 158 url = "https://github.com/mumble-voip/mumble/commit/fbd21bd422367bed19f801bf278562f567cbb8b7.patch"; 159 sha256 = "sha256-qFhC2j/cOWzAhs+KTccDIdcgFqfr4y4VLjHiK458Ucs="; 160 }) 161 ]; 162 163 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' 164 # The build erraneously marks the *.dylib as executable 165 # which causes the qt-hook to wrap it, which then prevents the app from loading it 166 chmod -x $out/lib/mumble/plugins/*.dylib 167 168 # Post-processing for the app bundle 169 $NIX_BUILD_TOP/source/macx/scripts/osxdist.py \ 170 --source-dir=$NIX_BUILD_TOP/source/ \ 171 --binary-dir=$out \ 172 --only-appbundle \ 173 --version "${source.version}" 174 175 mkdir -p $out/Applications $out/bin 176 mv $out/Mumble.app $out/Applications/Mumble.app 177 178 # ensure that the app can be started from the shell 179 makeWrapper $out/Applications/Mumble.app/Contents/MacOS/mumble $out/bin/mumble 180 ''; 181 182 postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' 183 wrapProgram $out/bin/mumble \ 184 --prefix LD_LIBRARY_PATH : "${ 185 lib.makeLibraryPath ( 186 lib.optional pulseSupport libpulseaudio ++ lib.optional pipewireSupport pipewire 187 ) 188 }" 189 ''; 190 191 } source; 192 193 server = 194 source: 195 generic { 196 type = "murmur"; 197 198 cmakeFlags = [ 199 "-D client=OFF" 200 (lib.cmakeBool "ice" iceSupport) 201 ] 202 ++ lib.optionals iceSupport [ 203 "-D Ice_HOME=${lib.getDev zeroc-ice};${lib.getLib zeroc-ice}" 204 "-D Ice_SLICE_DIR=${lib.getDev zeroc-ice}/share/ice/slice" 205 ]; 206 207 buildInputs = [ libcap ] ++ lib.optional iceSupport zeroc-ice; 208 } source; 209 210 overlay = 211 source: 212 generic { 213 stdenv = stdenv_32bit; 214 type = "mumble-overlay"; 215 216 cmakeFlags = [ 217 "-D server=OFF" 218 "-D client=OFF" 219 "-D overlay=ON" 220 ]; 221 } source; 222 223 source = rec { 224 version = "1.5.735"; 225 226 # Needs submodules 227 src = fetchFromGitHub { 228 owner = "mumble-voip"; 229 repo = "mumble"; 230 rev = "v${version}"; 231 hash = "sha256-JRnGgxkf5ct6P71bYgLbCEUmotDLS2Evy6t8R7ac7D4="; 232 fetchSubmodules = true; 233 }; 234 }; 235in 236{ 237 mumble = lib.recursiveUpdate (client source) { meta.mainProgram = "mumble"; }; 238 murmur = lib.recursiveUpdate (server source) { meta.mainProgram = "mumble-server"; }; 239 overlay = overlay source; 240}