1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 stdenv, 6 7 # build-system 8 pybind11, 9 setuptools, 10 11 # native dependencies 12 abseil-cpp, 13 14 # tests 15 pytestCheckHook, 16}: 17 18buildPythonPackage rec { 19 pname = "webrtc-noise-gain"; 20 version = "1.2.5"; 21 pyproject = true; 22 23 src = fetchFromGitHub { 24 owner = "rhasspy"; 25 repo = "webrtc-noise-gain"; 26 tag = "v${version}"; 27 hash = "sha256-GbdG2XM11zgPk2VZ0mu7qMv256jaMyJDHdBCBUnynMY="; 28 }; 29 30 postPatch = with stdenv.hostPlatform.uname; '' 31 # Configure the correct host platform for cross builds 32 substituteInPlace setup.py --replace-fail \ 33 "system = platform.system().lower()" \ 34 'system = "${lib.toLower system}"' 35 substituteInPlace setup.py --replace-fail \ 36 "machine = platform.machine().lower()" \ 37 'machine = "${lib.toLower processor}"' 38 ''; 39 40 nativeBuildInputs = [ 41 pybind11 42 setuptools 43 ]; 44 45 buildInputs = [ abseil-cpp ]; 46 47 pythonImportsCheck = [ "webrtc_noise_gain" ]; 48 49 nativeCheckInputs = [ pytestCheckHook ]; 50 51 meta = with lib; { 52 description = "Tiny wrapper around webrtc-audio-processing for noise suppression/auto gain only"; 53 homepage = "https://github.com/rhasspy/webrtc-noise-gain"; 54 changelog = "https://github.com/rhasspy/webrtc-noise-gain/blob/${src.rev}/CHANGELOG.md"; 55 license = licenses.mit; 56 maintainers = with maintainers; [ hexa ]; 57 }; 58}