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

142 lines
3.8 KiB
Nix
Raw Normal View History

2021-02-22 07:25:23 +00:00
{ lib, stdenv, fetchFromGitHub, pkg-config, qt5
, avahi, boost, libopus, libsndfile, protobuf, speex, libcap
, alsaLib, python3
, rnnoise
, jackSupport ? false, libjack2
, speechdSupport ? false, speechd
, pulseSupport ? false, libpulseaudio
, iceSupport ? false, zeroc-ice
2021-03-13 23:15:33 +00:00
, grpcSupport ? false, grpc, which
2020-04-16 07:21:21 +00:00
, nixosTests
}:
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 = [ pkg-config python3 qt5.qmake ]
++ (overrides.nativeBuildInputs or [ ]);
2019-09-14 08:49:38 +00:00
buildInputs = [ boost protobuf avahi ]
++ (overrides.buildInputs or [ ]);
2016-04-16 23:38:29 +00:00
qmakeFlags = [
"CONFIG+=c++11"
"CONFIG+=shared"
"CONFIG+=no-g15"
"CONFIG+=packaged"
"CONFIG+=no-update"
"CONFIG+=no-embed-qt-translations"
2015-10-12 14:04:49 +00:00
"CONFIG+=bundled-celt"
"CONFIG+=no-bundled-opus"
"CONFIG+=no-bundled-speex"
"DEFINES+=PLUGIN_PATH=${placeholder "out"}/lib/mumble"
] ++ lib.optional (!speechdSupport) "CONFIG+=no-speechd"
++ lib.optional jackSupport "CONFIG+=no-oss CONFIG+=no-alsa CONFIG+=jackaudio"
++ (overrides.configureFlags or [ ]);
2016-04-16 23:38:29 +00:00
preConfigure = ''
2017-03-31 20:11:16 +00: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
'';
2020-04-16 07:21:21 +00:00
passthru.tests.connectivity = nixosTests.mumble;
meta = with lib; {
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 ]
++ lib.optional stdenv.isLinux alsaLib
++ lib.optional jackSupport libjack2
++ lib.optional speechdSupport speechd
++ lib.optional pulseSupport libpulseaudio;
configureFlags = [
"CONFIG+=no-server"
];
NIX_CFLAGS_COMPILE = lib.optional speechdSupport "-I${speechd}/include/speech-dispatcher";
2016-04-22 23:21:34 +00:00
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 08:49:38 +00:00
server = source: generic {
type = "murmur";
postPatch = lib.optional iceSupport ''
2019-09-14 08:49:38 +00:00
grep -Rl '/usr/share/Ice' . | xargs sed -i 's,/usr/share/Ice/,${zeroc-ice.dev}/share/ice/,g'
'';
configureFlags = [
"CONFIG+=no-client"
] ++ lib.optional (!iceSupport) "CONFIG+=no-ice"
++ lib.optional grpcSupport "CONFIG+=grpc";
2020-08-28 20:11:27 +00:00
buildInputs = [ libcap ]
++ lib.optional iceSupport zeroc-ice
2021-03-13 23:15:33 +00:00
++ lib.optionals grpcSupport [ grpc which ];
installPhase = ''
# bin stuff
install -Dm755 release/murmurd $out/bin/murmurd
'';
} source;
2019-09-14 08:49:38 +00:00
source = rec {
version = "1.3.4";
2016-04-22 23:22:03 +00:00
# Needs submodules
src = fetchFromGitHub {
owner = "mumble-voip";
repo = "mumble";
rev = version;
2021-02-10 08:44:47 +00:00
sha256 = "sha256-njovShQpW0JNeeE8VugdmGzDk3fKG8/fcJoBgdyTZug=";
fetchSubmodules = true;
};
};
in {
2019-09-14 08:49:38 +00:00
mumble = client source;
murmur = server source;
}