lol
1{ stdenv, fetchgit, cmake, pkgconfig, libusb1 }:
2
3stdenv.mkDerivation rec {
4 name = "rtl-sdr-${version}";
5 version = "0.5.3";
6
7 src = fetchgit {
8 url = "git://git.osmocom.org/rtl-sdr.git";
9 rev = "refs/tags/v${version}";
10 sha256 = "00r5d08r12zzkd0xggd7l7p4r2278rzdhqdaihwjlajmr9qd3hs1";
11 };
12
13 buildInputs = [ cmake pkgconfig libusb1 ];
14
15 # TODO: get these fixes upstream:
16 # * Building with -DINSTALL_UDEV_RULES=ON tries to install udev rules to
17 # /etc/udev/rules.d/, and there is no option to install elsewhere. So install
18 # rules manually.
19 # * Propagate libusb-1.0 dependency in pkg-config file.
20 postInstall = ''
21 mkdir -p "$out/etc/udev/rules.d/"
22 cp ../rtl-sdr.rules "$out/etc/udev/rules.d/99-rtl-sdr.rules"
23
24 pcfile="$out"/lib/pkgconfig/librtlsdr.pc
25 grep -q "Requires:" "$pcfile" && { echo "Upstream has added 'Requires:' in $(basename "$pcfile"); update nix expression."; exit 1; }
26 echo "Requires: libusb-1.0" >> "$pcfile"
27 '';
28
29 meta = with stdenv.lib; {
30 description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
31 homepage = http://sdr.osmocom.org/trac/wiki/rtl-sdr;
32 license = licenses.gpl2Plus;
33 platforms = platforms.linux;
34 maintainers = [ maintainers.bjornfor ];
35 };
36}