about summary refs log tree commit diff
path: root/pkgs/by-name/rt/rtl_fm_streamer/package.nix
blob: 05874d6461085737cfb5edbe4cb54eea71729a13 (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
{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, libusb1
, libev
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "rtl_fm_streamer";
  version = "unstable-2021-06-08";

  src = fetchFromGitHub {
    owner = "AlbrechtL";
    repo = "rtl_fm_streamer";
    rev = "ceb2bf06883f986ed01aa57c84989ba35b6b9a27";
    sha256 = "sha256-9M7GS6AC7HEJge04vl7V6ZdtwWvbMu/Rhaf9fwQa9WA=";
  };

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace '/etc/udev/rules.d' "$out/etc/udev/rules.d"

    substituteInPlace rtl-sdr.rules \
      --replace 'MODE:="0666"' 'ENV{ID_SOFTWARE_RADIO}="1", MODE="0660", GROUP="plugdev"'
  '';

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    libusb1
    libev
  ];

  cmakeFlags = [
    (lib.cmakeBool "INSTALL_UDEV_RULES" stdenv.isLinux)
  ];

  meta = {
    description = "Turns your Realtek RTL2832 based DVB dongle into a FM radio stereo receiver";
    homepage = "https://github.com/AlbrechtL/rtl_fm_streamer";
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ doronbehar ];
    broken = stdenv.isDarwin && stdenv.isx86_64;
  };
})