1{ 2 name = "Python Soundcard Library Test"; 3 4 nodes.machine = 5 { pkgs, ... }: 6 { 7 environment.systemPackages = [ (pkgs.python3.withPackages (ps: [ ps.soundcard ])) ]; 8 9 services.pulseaudio.enable = true; 10 services.pulseaudio.systemWide = true; 11 12 virtualisation.qemu.options = [ 13 "-device virtio-sound-pci,audiodev=my_audiodev" 14 "-audiodev wav,id=my_audiodev" 15 ]; 16 }; 17 18 interactive.nodes.machine = 19 { ... }: 20 { 21 services.openssh.enable = true; 22 services.openssh.settings.PermitRootLogin = "yes"; 23 users.extraUsers.root.initialPassword = ""; 24 users.extraUsers.root.hashedPassword = null; 25 users.extraUsers.root.hashedPasswordFile = null; 26 users.extraUsers.root.initialHashedPassword = null; 27 virtualisation.forwardPorts = [ 28 { 29 from = "host"; 30 host.port = 2222; 31 guest.port = 22; 32 } 33 ]; 34 }; 35 36 testScript = 37 let 38 script = builtins.toFile "import.py" '' 39 import soundcard 40 ''; 41 in 42 '' 43 start_all() 44 machine.wait_for_unit("multi-user.target") 45 machine.succeed("python ${script}") 46 ''; 47}