about summary refs log tree commit diff
path: root/pkgs/applications/audio/scream/default.nix
blob: 3c0b83d46c193af5a88daf3c18cd7dcd7fd7e5ee (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
48
49
50
{ stdenv, lib, config, fetchFromGitHub, cmake, pkg-config
, alsaSupport ? stdenv.isLinux, alsa-lib
, pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio
, jackSupport ? false, libjack2, soxr
, pcapSupport ? false, libpcap
}:

stdenv.mkDerivation rec {
  pname = "scream";
  version = "4.0";

  src = fetchFromGitHub {
    owner = "duncanthrax";
    repo = pname;
    rev = version;
    sha256 = "sha256-lP5mdNhZjkEVjgQUEsisPy+KXUqsE6xj6dFWcgD+VGM=";
  };

  buildInputs = lib.optional pulseSupport libpulseaudio
    ++ lib.optionals jackSupport [ libjack2 soxr ]
    ++ lib.optional alsaSupport alsa-lib
    ++ lib.optional pcapSupport libpcap;
  nativeBuildInputs = [ cmake pkg-config ];

  cmakeFlags = [
    "-DPULSEAUDIO_ENABLE=${if pulseSupport then "ON" else "OFF"}"
    "-DALSA_ENABLE=${if alsaSupport then "ON" else "OFF"}"
    "-DJACK_ENABLE=${if jackSupport then "ON" else "OFF"}"
    "-DPCAP_ENABLE=${if pcapSupport then "ON" else "OFF"}"
  ];

  cmakeDir = "../Receivers/unix";

  doInstallCheck = true;
  installCheckPhase = ''
    set +o pipefail

    # Programs exit with code 1 when testing help, so grep for a string
    $out/bin/scream -h 2>&1 | grep -q Usage:
  '';

  meta = with lib; {
    description = "Audio receiver for the Scream virtual network sound card";
    homepage = "https://github.com/duncanthrax/scream";
    license = licenses.mspl;
    platforms = platforms.linux;
    mainProgram = "scream";
    maintainers = with maintainers; [ arcnmx ];
  };
}