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