diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index f0fa282118d6..26e72ef2bc1f 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -12705,6 +12705,12 @@ githubId = 427866; name = "Matthias Beyer"; }; + matthiasdotsh = { + email = "git@matthias.sh"; + name = "Matthias"; + github = "matthiasdotsh"; + githubId = 142118899; + }; matthiasq = { email = "matthias.queitsch@mailbox.org"; github = "matthias-Q"; diff --git a/pkgs/development/python-modules/soundcard/default.nix b/pkgs/development/python-modules/soundcard/default.nix new file mode 100644 index 000000000000..6fd42cd2ec91 --- /dev/null +++ b/pkgs/development/python-modules/soundcard/default.nix @@ -0,0 +1,50 @@ +{ + buildPythonPackage, + cffi, + fetchPypi, + lib, + libpulseaudio, + numpy, + setuptools, + testers, +}: +let + version = "0.4.3"; +in +buildPythonPackage { + inherit version; + pname = "soundcard"; + pyproject = true; + + src = fetchPypi { + inherit version; + pname = "SoundCard"; + hash = "sha256-QQg1UUuhCAmAPLmIfUJw85K1nq82WRW7lFFq8/ix0Dc="; + }; + + patchPhase = '' + substituteInPlace soundcard/pulseaudio.py \ + --replace "'pulse'" "'${libpulseaudio}/lib/libpulse.so'" + ''; + + build-system = [ setuptools ]; + + dependencies = [ + cffi + numpy + ]; + + # doesn't work because there are not many soundcards in the + # sandbox. See VM-test + # pythonImportsCheck = [ "soundcard" ]; + + passthru.tests.vm-with-soundcard = testers.runNixOSTest ./test.nix; + + meta = { + description = "Pure-Python Real-Time Audio Library"; + homepage = "https://github.com/bastibe/SoundCard"; + changelog = "https://github.com/bastibe/SoundCard/blob/${version}/README.rst#changelog"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ matthiasdotsh ]; + }; +} diff --git a/pkgs/development/python-modules/soundcard/test.nix b/pkgs/development/python-modules/soundcard/test.nix new file mode 100644 index 000000000000..720e7336cd6a --- /dev/null +++ b/pkgs/development/python-modules/soundcard/test.nix @@ -0,0 +1,47 @@ +{ + name = "Python Soundcard Library Test"; + + nodes.machine = + { pkgs, ... }: + { + environment.systemPackages = [ (pkgs.python3.withPackages (ps: [ ps.soundcard ])) ]; + + hardware.pulseaudio.enable = true; + hardware.pulseaudio.systemWide = true; + + virtualisation.qemu.options = [ + "-device virtio-sound-pci,audiodev=my_audiodev" + "-audiodev wav,id=my_audiodev" + ]; + }; + + interactive.nodes.machine = + { ... }: + { + services.openssh.enable = true; + services.openssh.settings.PermitRootLogin = "yes"; + users.extraUsers.root.initialPassword = ""; + users.extraUsers.root.hashedPassword = null; + users.extraUsers.root.hashedPasswordFile = null; + users.extraUsers.root.initialHashedPassword = null; + virtualisation.forwardPorts = [ + { + from = "host"; + host.port = 2222; + guest.port = 22; + } + ]; + }; + + testScript = + let + script = builtins.toFile "import.py" '' + import soundcard + ''; + in + '' + start_all() + machine.wait_for_unit("multi-user.target") + machine.succeed("python ${script}") + ''; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6fa07f66a679..0fd0de0df609 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -14566,6 +14566,8 @@ self: super: with self; { sortedcontainers = callPackage ../development/python-modules/sortedcontainers { }; + soundcard = callPackage ../development/python-modules/soundcard { }; + soundcloud-v2 = callPackage ../development/python-modules/soundcloud-v2 { }; sounddevice = callPackage ../development/python-modules/sounddevice { };