nixpkgs/pkgs/applications/misc/rtl-sdr/default.nix
Bjørn Forsman 346f20305b rtl-sdr: add "Require: libusb-1.0" to pkg-config file
So that building 3rd party code works out of the box. (E.g. building
dump1090[1] works now).

[1]: https://github.com/antirez/dump1090
2014-10-30 08:33:16 +01:00

37 lines
1.2 KiB
Nix

{ stdenv, fetchgit, cmake, pkgconfig, libusb1 }:
stdenv.mkDerivation rec {
name = "rtl-sdr-${version}";
version = "0.5.3";
src = fetchgit {
url = "git://git.osmocom.org/rtl-sdr.git";
rev = "refs/tags/v${version}";
sha256 = "00r5d08r12zzkd0xggd7l7p4r2278rzdhqdaihwjlajmr9qd3hs1";
};
buildInputs = [ cmake pkgconfig libusb1 ];
# TODO: get these fixes upstream:
# * Building with -DINSTALL_UDEV_RULES=ON tries to install udev rules to
# /etc/udev/rules.d/, and there is no option to install elsewhere. So install
# rules manually.
# * Propagate libusb-1.0 dependency in pkg-config file.
postInstall = ''
mkdir -p "$out/etc/udev/rules.d/"
cp ../rtl-sdr.rules "$out/etc/udev/rules.d/99-rtl-sdr.rules"
pcfile="$out"/lib/pkgconfig/librtlsdr.pc
grep -q "Requires:" "$pcfile" && { echo "Upstream has added 'Requires:' in $(basename "$pcfile"); update nix expression."; exit 1; }
echo "Requires: libusb-1.0" >> "$pcfile"
'';
meta = with stdenv.lib; {
description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
homepage = http://sdr.osmocom.org/trac/wiki/rtl-sdr;
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = [ maintainers.bjornfor ];
};
}