-
-
Notifications
You must be signed in to change notification settings - Fork 14k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python3Packages.soundcard: init at 0.4.3
- Loading branch information
1 parent
29c6f7d
commit b74c97b
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}") | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters