22 lib ,
33 stdenv ,
44 fetchFromGitHub ,
5- fetchpatch ,
65 pkg-config ,
76 qt5 ,
87 cmake ,
2221 libogg ,
2322 libvorbis ,
2423 stdenv_32bit ,
24+ alsaSupport ? stdenv . hostPlatform . isLinux ,
2525 iceSupport ? true ,
2626 zeroc-ice ,
2727 jackSupport ? false ,
2828 libjack2 ,
29- pipewireSupport ? true ,
29+ pipewireSupport ? stdenv . hostPlatform . isLinux ,
3030 pipewire ,
3131 pulseSupport ? true ,
3232 libpulseaudio ,
3333 speechdSupport ? false ,
3434 speechd-minimal ,
3535 microsoft-gsl ,
3636 nlohmann_json ,
37+ xar ,
38+ makeWrapper ,
3739} :
3840
3941let
5456 qt5 . qttools
5557 ] ++ ( overrides . nativeBuildInputs or [ ] ) ;
5658
57- buildInputs = [
58- avahi
59- boost
60- poco
61- protobuf
62- microsoft-gsl
63- nlohmann_json
64- ] ++ ( overrides . buildInputs or [ ] ) ;
59+ buildInputs =
60+ [
61+ boost
62+ poco
63+ protobuf
64+ microsoft-gsl
65+ nlohmann_json
66+ ]
67+ ++ lib . optionals stdenv . hostPlatform . isLinux [ avahi ]
68+ ++ ( overrides . buildInputs or [ ] ) ;
6569
6670 cmakeFlags = [
6771 "-D g15=OFF"
8589 felixsinger
8690 lilacious
8791 ] ;
88- platforms = platforms . linux ;
92+ platforms = platforms . linux ++ ( overrides . platforms or [ ] ) ;
8993 } ;
9094 }
9195 ) ;
9599 generic {
96100 type = "mumble" ;
97101
98- nativeBuildInputs = [ qt5 . qttools ] ;
102+ platforms = lib . platforms . darwin ;
103+ nativeBuildInputs =
104+ [ qt5 . qttools ]
105+ ++ lib . optionals stdenv . hostPlatform . isDarwin [
106+ makeWrapper
107+ ] ;
108+
99109 buildInputs =
100110 [
101111 flac
@@ -107,12 +117,14 @@ let
107117 qt5 . qtsvg
108118 rnnoise
109119 ]
110- ++ lib . optional ( ! jackSupport ) alsa-lib
120+ ++ lib . optional ( ! jackSupport && alsaSupport ) alsa-lib
111121 ++ lib . optional jackSupport libjack2
112122 ++ lib . optional speechdSupport speechd-minimal
113123 ++ lib . optional pulseSupport libpulseaudio
114- ++ lib . optional pipewireSupport pipewire ;
115-
124+ ++ lib . optional pipewireSupport pipewire
125+ ++ lib . optionals stdenv . hostPlatform . isDarwin [
126+ xar
127+ ] ;
116128
117129 cmakeFlags = [
118130 "-D server=OFF"
@@ -122,23 +134,52 @@ let
122134 "-D overlay-xcompile=OFF"
123135 "-D oss=OFF"
124136 "-D warnings-as-errors=OFF" # conversion error workaround
137+ # building the overlay on darwin does not work in nipxkgs (yet)
138+ # also see the patch below to disable scripts the build option misses
139+ # see https://github.com/mumble-voip/mumble/issues/6816
140+ ( lib . cmakeBool "overlay" ( ! stdenv . hostPlatform . isDarwin ) )
125141 ( lib . cmakeBool "speechd" speechdSupport )
126142 ( lib . cmakeBool "pulseaudio" pulseSupport )
127143 ( lib . cmakeBool "pipewire" pipewireSupport )
128144 ( lib . cmakeBool "jackaudio" jackSupport )
129- ( lib . cmakeBool "alsa" ( ! jackSupport ) )
145+ ( lib . cmakeBool "alsa" ( ! jackSupport && alsaSupport ) )
130146 ] ;
131147
132148 env . NIX_CFLAGS_COMPILE = lib . optionalString speechdSupport "-I${ speechd-minimal } /include/speech-dispatcher" ;
133149
134- postFixup = ''
150+ patches = [
151+ ./disable-overlay-build.patch
152+ ./fix-plugin-copy.patch
153+ ] ;
154+
155+ postInstall = lib . optionalString stdenv . hostPlatform . isDarwin ''
156+ # The build erraneously marks the *.dylib as executable
157+ # which causes the qt-hook to wrap it, which then prevents the app from loading it
158+ chmod -x $out/lib/mumble/plugins/*.dylib
159+
160+ # Post-processing for the app bundle
161+ $NIX_BUILD_TOP/source/macx/scripts/osxdist.py \
162+ --source-dir=$NIX_BUILD_TOP/source/ \
163+ --binary-dir=$out \
164+ --only-appbundle \
165+ --version "${ source . version } "
166+
167+ mkdir -p $out/Applications $out/bin
168+ mv $out/Mumble.app $out/Applications/Mumble.app
169+
170+ # ensure that the app can be started from the shell
171+ makeWrapper $out/Applications/Mumble.app/Contents/MacOS/mumble $out/bin/mumble
172+ '' ;
173+
174+ postFixup = lib . optionalString stdenv . hostPlatform . isLinux ''
135175 wrapProgram $out/bin/mumble \
136176 --prefix LD_LIBRARY_PATH : "${
137177 lib . makeLibraryPath (
138178 lib . optional pulseSupport libpulseaudio ++ lib . optional pipewireSupport pipewire
139179 )
140180 } "
141181 '' ;
182+
142183 } source ;
143184
144185 server =
0 commit comments