1{
2 buildPythonPackage,
3 cffi,
4 fetchPypi,
5 lib,
6 libpulseaudio,
7 numpy,
8 setuptools,
9 testers,
10}:
11let
12 version = "0.4.3";
13in
14buildPythonPackage {
15 inherit version;
16 pname = "soundcard";
17 pyproject = true;
18
19 src = fetchPypi {
20 inherit version;
21 pname = "SoundCard";
22 hash = "sha256-QQg1UUuhCAmAPLmIfUJw85K1nq82WRW7lFFq8/ix0Dc=";
23 };
24
25 patchPhase = ''
26 substituteInPlace soundcard/pulseaudio.py \
27 --replace "'pulse'" "'${libpulseaudio}/lib/libpulse.so'"
28 '';
29
30 build-system = [ setuptools ];
31
32 dependencies = [
33 cffi
34 numpy
35 ];
36
37 # doesn't work because there are not many soundcards in the
38 # sandbox. See VM-test
39 # pythonImportsCheck = [ "soundcard" ];
40
41 passthru.tests.vm-with-soundcard = testers.runNixOSTest ./test.nix;
42
43 meta = {
44 description = "Pure-Python Real-Time Audio Library";
45 homepage = "https://github.com/bastibe/SoundCard";
46 changelog = "https://github.com/bastibe/SoundCard/blob/${version}/README.rst#changelog";
47 license = lib.licenses.bsd3;
48 maintainers = with lib.maintainers; [ matthiasdotsh ];
49 };
50}