Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / networking / mumble / default.nix
blob27fdde3c2a660eb3b8a77797b5d582c6c1785f7f
1 { lib, stdenv, fetchFromGitHub, fetchpatch, pkg-config, qt5, cmake
2 , avahi, boost, libopus, libsndfile, protobuf, speex, libcap
3 , alsa-lib, python3
4 , rnnoise
5 , nixosTests
6 , poco
7 , flac
8 , libogg
9 , libvorbis
10 , iceSupport ? true, zeroc-ice
11 , jackSupport ? false, libjack2
12 , pipewireSupport ? true, pipewire
13 , pulseSupport ? true, libpulseaudio
14 , speechdSupport ? false, speechd
17 let
18   generic = overrides: source: stdenv.mkDerivation (source // overrides // {
19     pname = overrides.type;
20     version = source.version;
22     patches = [
23       ./0001-BUILD-crypto-Migrate-to-OpenSSL-3.0-compatible-API.patch
24       # fix crash caused by openssl3 thread unsafe evp implementation
25       # see https://github.com/mumble-voip/mumble/issues/5361#issuecomment-1173001440
26       (fetchpatch {
27         url = "https://github.com/mumble-voip/mumble/commit/f8d47db318f302f5a7d343f15c9936c7030c49c4.patch";
28         hash = "sha256-xk8vBrPwvQxHCY8I6WQJAyaBGHmlH9NCixweP6FyakU=";
29       })
30       ./0002-FIX-positional-audio-Force-8-bytes-alignment-for-CCa.patch
31     ];
33     nativeBuildInputs = [ cmake pkg-config python3 qt5.wrapQtAppsHook qt5.qttools ]
34       ++ (overrides.nativeBuildInputs or [ ]);
36     buildInputs = [ avahi boost poco protobuf ]
37       ++ (overrides.buildInputs or [ ]);
39     cmakeFlags = [
40       "-D g15=OFF"
41     ] ++ (overrides.configureFlags or [ ]);
43     preConfigure = ''
44        patchShebangs scripts
45     '';
47     passthru.tests.connectivity = nixosTests.mumble;
49     meta = with lib; {
50       description = "Low-latency, high quality voice chat software";
51       homepage = "https://mumble.info";
52       license = licenses.bsd3;
53       maintainers = with maintainers; [ infinisil felixsinger ];
54       platforms = platforms.linux;
55     };
56   });
58   client = source: generic {
59     type = "mumble";
61     nativeBuildInputs = [ qt5.qttools ];
62     buildInputs = [ flac libogg libopus libsndfile libvorbis qt5.qtsvg rnnoise speex ]
63       ++ lib.optional (!jackSupport) alsa-lib
64       ++ lib.optional jackSupport libjack2
65       ++ lib.optional speechdSupport speechd
66       ++ lib.optional pulseSupport libpulseaudio
67       ++ lib.optional pipewireSupport pipewire;
69     configureFlags = [
70       "-D server=OFF"
71       "-D bundled-celt=ON"
72       "-D bundled-opus=OFF"
73       "-D bundled-speex=OFF"
74       "-D bundled-rnnoise=OFF"
75       "-D bundle-qt-translations=OFF"
76       "-D update=OFF"
77       "-D overlay-xcompile=OFF"
78       "-D oss=OFF"
79     ] ++ lib.optional (!speechdSupport) "-D speechd=OFF"
80       ++ lib.optional (!pulseSupport) "-D pulseaudio=OFF"
81       ++ lib.optional (!pipewireSupport) "-D pipewire=OFF"
82       ++ lib.optional jackSupport "-D alsa=OFF -D jackaudio=ON";
84     env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd}/include/speech-dispatcher";
86     postFixup = ''
87       wrapProgram $out/bin/mumble \
88         --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath (lib.optional pulseSupport libpulseaudio ++ lib.optional pipewireSupport pipewire)}"
89     '';
90   } source;
92   server = source: generic {
93     type = "murmur";
95     configureFlags = [
96       "-D client=OFF"
97     ] ++ lib.optional (!iceSupport) "-D ice=OFF"
98       ++ lib.optionals iceSupport [
99         "-D Ice_HOME=${lib.getDev zeroc-ice};${lib.getLib zeroc-ice}"
100         "-D CMAKE_PREFIX_PATH=${lib.getDev zeroc-ice};${lib.getLib zeroc-ice}"
101         "-D Ice_SLICE_DIR=${lib.getDev zeroc-ice}/share/ice/slice"
102       ];
104     buildInputs = [ libcap ]
105       ++ lib.optional iceSupport zeroc-ice;
106   } source;
108   source = rec {
109     version = "1.4.287";
111     # Needs submodules
112     src = fetchFromGitHub {
113       owner = "mumble-voip";
114       repo = "mumble";
115       rev = "5d808e287e99b402b724e411a7a0848e00956a24";
116       sha256 = "sha256-SYsGCuj3HeyAQRUecGLaRdJR9Rm7lbaM54spY/zx0jU=";
117       fetchSubmodules = true;
118     };
120     patches = [
121       # fixes 'static assertion failed: static_assert(sizeof(CCameraAngles) == 0x408, "");'
122       # when compiling pkgsi686Linux.mumble, which is a dependency of x64 mumble_overlay
123       # https://github.com/mumble-voip/mumble/pull/5850
124       # Remove with next version update
125       (fetchpatch {
126         url = "https://github.com/mumble-voip/mumble/commit/13c051b36b387356815cff5d685bc628b74ba136.patch";
127         hash = "sha256-Rq8fb6NFd4DCNWm6OOMYIP7tBllufmQcB5CSxPU4qqg=";
128       })
129     ];
130   };
131 in {
132   mumble  = client source;
133   murmur  = server source;