about summary refs log tree commit diff
path: root/pkgs/development/python-modules/soundcard/test.nix
blob: 720e7336cd6afdbeecd0829acd151b48e4b768f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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}")
    '';
}