2019-06-16 22:59:06 +03:00
|
|
|
{ stdenv, fetchgit, cmake, pkgconfig, libusb1 }:
|
2014-03-08 03:42:42 +04:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 15:41:18 +03:00
|
|
|
pname = "rtl-sdr";
|
2018-10-05 11:11:02 +03:00
|
|
|
version = "0.6.0";
|
2014-03-08 03:42:42 +04:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "git://git.osmocom.org/rtl-sdr.git";
|
2018-10-05 11:11:02 +03:00
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
sha256 = "0lmvsnb4xw4hmz6zs0z5ilsah5hjz29g1s0050n59fllskqr3b8k";
|
2014-03-08 03:42:42 +04:00
|
|
|
};
|
|
|
|
|
2017-09-06 00:26:13 +03:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = [ cmake libusb1 ];
|
2014-03-08 03:42:42 +04:00
|
|
|
|
2014-10-30 10:26:19 +03:00
|
|
|
# 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.
|
2017-07-15 03:24:15 +03:00
|
|
|
postInstall = stdenv.lib.optionalString stdenv.isLinux ''
|
2014-03-08 03:42:42 +04:00
|
|
|
mkdir -p "$out/etc/udev/rules.d/"
|
|
|
|
cp ../rtl-sdr.rules "$out/etc/udev/rules.d/99-rtl-sdr.rules"
|
2014-10-30 10:26:19 +03:00
|
|
|
|
|
|
|
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"
|
2014-03-08 03:42:42 +04:00
|
|
|
'';
|
2018-12-09 13:18:13 +03:00
|
|
|
|
2014-03-08 03:42:42 +04:00
|
|
|
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;
|
2017-07-15 03:24:15 +03:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2014-03-08 03:42:42 +04:00
|
|
|
maintainers = [ maintainers.bjornfor ];
|
|
|
|
};
|
|
|
|
}
|