Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / miniaudio / default.nix
blob973d4b40822e003a9ee9f306ff8f32df8938151a
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , pythonOlder
5 , fetchFromGitHub
6 , miniaudio
7 , cffi
8 , pytestCheckHook
9 , AudioToolbox
10 , CoreAudio
13 let
14   # TODO: recheck after 1.59
15   miniaudio' = miniaudio.overrideAttrs (oldAttrs: rec {
16     version = "0.11.16"; # cffi breakage with 0.11.17
17     src = fetchFromGitHub {
18       inherit (oldAttrs.src) owner repo;
19       rev = "refs/tags/${version}";
20       hash = "sha256-POe/dYPJ25RKNGIhaLoqxm9JJ08MrTyHVN4NmaGOdwM=";
21     };
22   });
24 buildPythonPackage rec {
25   pname = "miniaudio";
26   version = "1.59";
28   disabled = pythonOlder "3.6";
30   format = "setuptools";
32   src = fetchFromGitHub {
33     owner = "irmen";
34     repo = "pyminiaudio";
35     rev = "refs/tags/v${version}";
36     hash = "sha256-tMQOGqEThtownW3cnNpCzWye0Uo/Es7E8abVySo1QnQ=";
37   };
39   postPatch = ''
40     rm -r miniaudio
41     ln -s ${miniaudio'} miniaudio
42     substituteInPlace build_ffi_module.py \
43       --replace "miniaudio/stb_vorbis.c" "miniaudio/extras/stb_vorbis.c";
44     substituteInPlace miniaudio.c \
45       --replace "miniaudio/stb_vorbis.c" "miniaudio/extras/stb_vorbis.c";
46   '';
48   buildInputs = lib.optionals stdenv.isDarwin [
49     AudioToolbox
50     CoreAudio
51   ];
53   propagatedNativeBuildInputs = [ cffi ];
54   propagatedBuildInputs = [ cffi ];
56   nativeCheckInputs = [
57     pytestCheckHook
58   ];
60   pythonImportsCheck = [ "miniaudio" ];
62   meta = with lib; {
63     description = "Python bindings for the miniaudio library and its decoders";
64     homepage = "https://github.com/irmen/pyminiaudio";
65     license = licenses.mit;
66     maintainers = with maintainers; [ dotlambda ];
67   };