From e41071c58f6477000e011574acfabc4ab7c06f87 Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Mon, 12 Jul 2021 22:12:24 +0200 Subject: [PATCH] Add override mumble --- overlays/10-previews.nix | 1 + overlays/mumble/default.nix | 8 ++ overlays/mumble/fix-rnnoise-argument.patch | 16 +++ overlays/mumble/overlay.nix | 36 ++++++ overlays/mumble/package.nix | 140 +++++++++++++++++++++ 5 files changed, 201 insertions(+) create mode 100644 overlays/mumble/default.nix create mode 100644 overlays/mumble/fix-rnnoise-argument.patch create mode 100644 overlays/mumble/overlay.nix create mode 100644 overlays/mumble/package.nix diff --git a/overlays/10-previews.nix b/overlays/10-previews.nix index 71a3080c..0761d0c1 100644 --- a/overlays/10-previews.nix +++ b/overlays/10-previews.nix @@ -3,6 +3,7 @@ let unstable = import super.sources.nixos-unstable { }; in { + inherit unstable; inherit (unstable) cachix nix-output-monitor cabal2nix; unstableHaskellPackages = unstable.haskellPackages; unstableGhc = unstable.ghc; diff --git a/overlays/mumble/default.nix b/overlays/mumble/default.nix new file mode 100644 index 00000000..1f32c3bd --- /dev/null +++ b/overlays/mumble/default.nix @@ -0,0 +1,8 @@ +final: prev: { + inherit (final.unstable.callPackage ./package.nix { + avahi = final.unstable.avahi-compat; + jackSupport = false; + speechdSupport = false; + pulseSupport = true; + }) mumble; +} diff --git a/overlays/mumble/fix-rnnoise-argument.patch b/overlays/mumble/fix-rnnoise-argument.patch new file mode 100644 index 00000000..78e8ed24 --- /dev/null +++ b/overlays/mumble/fix-rnnoise-argument.patch @@ -0,0 +1,16 @@ +nixpkgs has a more recent rnnoise than the one used by mumble, and rnnoise +changed the argument rnnoise_create[1], + +[1] https://github.com/xiph/rnnoise/commit/231b9c02d14a74cb449a98004cb7a2cf1bdeca2f + +--- old/src/mumble/AudioInput.cpp 2020-02-18 22:55:32.000000000 -0500 ++++ new/src/mumble/AudioInput.cpp 2020-02-18 22:58:08.000000000 -0500 +@@ -106,7 +106,7 @@ + #endif + + #ifdef USE_RNNOISE +- denoiseState = rnnoise_create(); ++ denoiseState = rnnoise_create(NULL); + #endif + + qWarning("AudioInput: %d bits/s, %d hz, %d sample", iAudioQuality, iSampleRate, iFrameSize); diff --git a/overlays/mumble/overlay.nix b/overlays/mumble/overlay.nix new file mode 100644 index 00000000..fcdb7563 --- /dev/null +++ b/overlays/mumble/overlay.nix @@ -0,0 +1,36 @@ +{ stdenv +, lib +, which +, file +, mumble +, mumble_i686 +}: + +let + binPath = lib.makeBinPath [ which file ]; +in +stdenv.mkDerivation { + name = "mumble-overlay-${mumble.version}"; + + inherit (mumble) src; + + phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; + + installPhase = '' + mkdir -p $out/lib + ln -s ${mumble}/lib/libmumble.so.1 $out/lib/ + + ${lib.optionalString (mumble_i686 != null) '' + mkdir -p $out/lib32 + ln -s ${mumble_i686}/lib/libmumble.so.1 $out/lib32/ + ''} + + install -Dm755 scripts/mumble-overlay $out/bin/mumble-overlay + sed -i "s,/usr/lib,$out/lib,g" $out/bin/mumble-overlay + sed -i '2iPATH="${binPath}:$PATH"' $out/bin/mumble-overlay + ''; + + meta = { + platforms = lib.platforms.linux; + }; +} diff --git a/overlays/mumble/package.nix b/overlays/mumble/package.nix new file mode 100644 index 00000000..844de84a --- /dev/null +++ b/overlays/mumble/package.nix @@ -0,0 +1,140 @@ +{ lib +, stdenv +, fetchFromGitHub +, pkg-config +, qt5 +, avahi +, boost +, libopus +, libsndfile +, protobuf +, speex +, libcap +, alsaLib +, python3 +, cmake +, poco +, pcre +, iceSupport ? false +, zeroc-ice +, rnnoise +, jackSupport ? false +, libjack2 +, pulseSupport ? false +, libpulseaudio +, grpcSupport ? false +, grpc +, which +, speechdSupport ? false +, speechd +, nixosTests +}: + +let + generic = overrides: source: qt5.mkDerivation (source // overrides // { + pname = overrides.type; + version = source.version; + + patches = (source.patches or [ ]); + nativeBuildInputs = [ pkg-config python3 cmake ] + ++ (overrides.nativeBuildInputs or [ ]); + + buildInputs = [ boost protobuf avahi ] + ++ (overrides.buildInputs or [ ]); + + passthru.tests.connectivity = nixosTests.mumble; + + meta = with lib; { + description = "Low-latency, high quality voice chat software"; + homepage = "https://mumble.info"; + license = licenses.bsd3; + maintainers = with maintainers; [ petabyteboy infinisil ]; + platforms = platforms.linux; + }; + }); + + client = source: generic + { + type = "mumble"; + + nativeBuildInputs = [ + qt5.qttools + ]; + + buildInputs = [ + libopus + libsndfile + speex + qt5.qtsvg + rnnoise + poco + pcre + speechd + zeroc-ice.all + ] + ++ lib.optional stdenv.isLinux alsaLib + ++ lib.optional jackSupport libjack2 + ++ lib.optional pulseSupport libpulseaudio; + + configureFlags = [ + "CONFIG+=no-server" + ]; + + cmakeFlags = [ + "-Dice=off" + "-Doverlay-xcompile=off" + "-DRELEASE_ID=${source.version}" + ]; + + installPhase = '' + # bin stuff + install -Dm755 mumble $out/bin/mumble + install -Dm755 $src/scripts/mumble-overlay $out/bin/mumble-overlay + + # lib stuff + mkdir -p $out/lib/mumble + cp -P libcelt* $out/lib/mumble + cp -rP plugins/* $out/lib/mumble + + # icons + install -Dm644 $src/scripts/org.mumble_voip.mumble.desktop $out/share/applications/mumble.desktop + install -Dm644 $src/icons/mumble.svg $out/share/icons/hicolor/scalable/apps/mumble.svg + ''; + } + source; + + server = source: generic + { + type = "murmur"; + + configureFlags = [ + "CONFIG+=no-client" + ]; + + buildInputs = [ libcap ] + ++ lib.optionals grpcSupport [ grpc which ]; + + installPhase = '' + # bin stuff + install -Dm755 release/murmurd $out/bin/murmurd + ''; + } + source; + + source = rec { + version = "1.4.0-development-snapshot-005"; + + # Needs submodules + src = fetchFromGitHub { + owner = "mumble-voip"; + repo = "mumble"; + rev = "${version}"; + sha256 = "sha256:1w16j5idbvvbbisj1jlk5igym2n2f67ia61yynibqbmpvyq0bg3z"; + fetchSubmodules = true; + }; + }; +in +{ + mumble = client source; + murmur = server source; +}