1{
2 stdenv,
3 lib,
4 config,
5 fetchFromGitHub,
6 cmake,
7 pkg-config,
8 alsaSupport ? stdenv.hostPlatform.isLinux,
9 alsa-lib,
10 pulseSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux,
11 libpulseaudio,
12 jackSupport ? false,
13 libjack2,
14 soxr,
15 pcapSupport ? false,
16 libpcap,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "scream";
21 version = "4.0";
22
23 src = fetchFromGitHub {
24 owner = "duncanthrax";
25 repo = "scream";
26 rev = version;
27 sha256 = "sha256-lP5mdNhZjkEVjgQUEsisPy+KXUqsE6xj6dFWcgD+VGM=";
28 };
29
30 buildInputs =
31 lib.optional pulseSupport libpulseaudio
32 ++ lib.optionals jackSupport [
33 libjack2
34 soxr
35 ]
36 ++ lib.optional alsaSupport alsa-lib
37 ++ lib.optional pcapSupport libpcap;
38 nativeBuildInputs = [
39 cmake
40 pkg-config
41 ];
42
43 cmakeFlags = [
44 "-DPULSEAUDIO_ENABLE=${if pulseSupport then "ON" else "OFF"}"
45 "-DALSA_ENABLE=${if alsaSupport then "ON" else "OFF"}"
46 "-DJACK_ENABLE=${if jackSupport then "ON" else "OFF"}"
47 "-DPCAP_ENABLE=${if pcapSupport then "ON" else "OFF"}"
48 ];
49
50 cmakeDir = "../Receivers/unix";
51
52 doInstallCheck = true;
53 installCheckPhase = ''
54 set +o pipefail
55
56 # Programs exit with code 1 when testing help, so grep for a string
57 $out/bin/scream -h 2>&1 | grep -q Usage:
58 '';
59
60 meta = with lib; {
61 description = "Audio receiver for the Scream virtual network sound card";
62 homepage = "https://github.com/duncanthrax/scream";
63 license = licenses.mspl;
64 platforms = platforms.linux;
65 mainProgram = "scream";
66 maintainers = with maintainers; [ arcnmx ];
67 };
68}