nixpkgs/pkgs/applications/networking/mumble/default.nix

151 lines
4.1 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, fetchFromGitHub, fetchpatch, pkgconfig, qt5
, avahi, boost, libopus, libsndfile, protobuf, speex, libcap
2017-03-31 21:11:16 +01:00
, alsaLib, python
, rnnoise
2015-04-26 07:32:04 +01:00
, jackSupport ? false, libjack2 ? null
, speechdSupport ? false, speechd ? null
2015-04-26 07:32:04 +01:00
, pulseSupport ? false, libpulseaudio ? null
2019-09-14 09:49:38 +01:00
, iceSupport ? false, zeroc-ice ? null
2020-08-28 21:11:27 +01:00
, grpcSupport ? false, grpc ? null, c-ares ? null, abseil-cpp ? null, which ? null
2020-04-16 08:21:21 +01:00
, nixosTests
}:
2015-04-26 07:32:04 +01:00
assert jackSupport -> libjack2 != null;
assert speechdSupport -> speechd != null;
2015-04-26 07:32:04 +01:00
assert pulseSupport -> libpulseaudio != null;
2019-09-14 09:49:38 +01:00
assert iceSupport -> zeroc-ice != null;
2020-08-28 21:11:27 +01:00
assert grpcSupport -> (grpc != null && c-ares != null && abseil-cpp != null && which != null);
with stdenv.lib;
let
generic = overrides: source: qt5.mkDerivation (source // overrides // {
2019-12-09 12:18:39 +00:00
pname = overrides.type;
version = source.version;
2020-02-19 13:01:22 +00:00
patches = (source.patches or [])
++ [ ./fix-rnnoise-argument.patch ];
nativeBuildInputs = [ pkgconfig python qt5.qmake ]
++ (overrides.nativeBuildInputs or [ ]);
2019-09-14 09:49:38 +01:00
buildInputs = [ boost protobuf avahi ]
++ (overrides.buildInputs or [ ]);
2016-04-17 00:38:29 +01:00
qmakeFlags = [
"CONFIG+=c++11"
"CONFIG+=shared"
"CONFIG+=no-g15"
"CONFIG+=packaged"
"CONFIG+=no-update"
"CONFIG+=no-embed-qt-translations"
2015-10-12 15:04:49 +01:00
"CONFIG+=bundled-celt"
"CONFIG+=no-bundled-opus"
"CONFIG+=no-bundled-speex"
"DEFINES+=PLUGIN_PATH=${placeholder "out"}/lib/mumble"
] ++ optional (!speechdSupport) "CONFIG+=no-speechd"
++ optional jackSupport "CONFIG+=no-oss CONFIG+=no-alsa CONFIG+=jackaudio"
++ (overrides.configureFlags or [ ]);
2016-04-17 00:38:29 +01:00
preConfigure = ''
2017-03-31 21:11:16 +01:00
patchShebangs scripts
'';
makeFlags = [ "release" ];
installPhase = ''
runHook preInstall
${overrides.installPhase}
# doc stuff
mkdir -p $out/share/man/man1
install -Dm644 man/mum* $out/share/man/man1/
runHook postInstall
'';
2016-01-03 00:30:32 +00:00
enableParallelBuilding = true;
2020-04-16 08:21:21 +01:00
passthru.tests.connectivity = nixosTests.mumble;
meta = {
description = "Low-latency, high quality voice chat software";
2019-12-09 12:18:39 +00:00
homepage = "https://mumble.info";
license = licenses.bsd3;
2020-01-25 21:05:14 +00:00
maintainers = with maintainers; [ petabyteboy infinisil ];
platforms = platforms.linux;
};
});
client = source: generic {
type = "mumble";
nativeBuildInputs = [ qt5.qttools ];
buildInputs = [ libopus libsndfile speex qt5.qtsvg rnnoise ]
++ optional stdenv.isLinux alsaLib
++ optional jackSupport libjack2
++ optional speechdSupport speechd
++ optional pulseSupport libpulseaudio;
configureFlags = [
"CONFIG+=no-server"
];
2016-04-23 00:21:34 +01:00
NIX_CFLAGS_COMPILE = optional speechdSupport "-I${speechd}/include/speech-dispatcher";
installPhase = ''
# bin stuff
install -Dm755 release/mumble $out/bin/mumble
install -Dm755 scripts/mumble-overlay $out/bin/mumble-overlay
# lib stuff
mkdir -p $out/lib/mumble
cp -P release/libmumble.so* $out/lib
cp -P release/libcelt* $out/lib/mumble
cp -P release/plugins/* $out/lib/mumble
# icons
install -Dm644 scripts/mumble.desktop $out/share/applications/mumble.desktop
install -Dm644 icons/mumble.svg $out/share/icons/hicolor/scalable/apps/mumble.svg
'';
} source;
2019-09-14 09:49:38 +01:00
server = source: generic {
type = "murmur";
postPatch = optional iceSupport ''
2019-09-14 09:49:38 +01:00
grep -Rl '/usr/share/Ice' . | xargs sed -i 's,/usr/share/Ice/,${zeroc-ice.dev}/share/ice/,g'
'';
configureFlags = [
"CONFIG+=no-client"
2020-08-28 21:11:27 +01:00
] ++ optional (!iceSupport) "CONFIG+=no-ice"
++ optional grpcSupport "CONFIG+=grpc";
2020-08-28 21:11:27 +01:00
buildInputs = [ libcap ]
++ optional iceSupport zeroc-ice
++ optionals grpcSupport [ grpc c-ares abseil-cpp which ];
installPhase = ''
# bin stuff
install -Dm755 release/murmurd $out/bin/murmurd
'';
} source;
2019-09-14 09:49:38 +01:00
source = rec {
2020-07-11 17:54:34 +01:00
version = "1.3.2";
2016-04-23 00:22:03 +01:00
# Needs submodules
src = fetchFromGitHub {
owner = "mumble-voip";
repo = "mumble";
rev = version;
2020-07-11 17:54:34 +01:00
sha256 = "1ljn7h7dr9iyhvq7rdh0prl7hzn9d2hhnxv0ni6dha6f7d9qbfy6";
fetchSubmodules = true;
};
};
in {
2019-09-14 09:49:38 +01:00
mumble = client source;
murmur = server source;
}