2020-08-29 01:28:51 +02:00
|
|
|
{ stdenv, fetchgit, fetchpatch, cmake, pkgconfig, libusb1 }:
|
2014-03-08 00:42:42 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "rtl-sdr";
|
2018-10-05 10:11:02 +02:00
|
|
|
version = "0.6.0";
|
2014-03-08 00:42:42 +01:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "git://git.osmocom.org/rtl-sdr.git";
|
2018-10-05 10:11:02 +02:00
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
sha256 = "0lmvsnb4xw4hmz6zs0z5ilsah5hjz29g1s0050n59fllskqr3b8k";
|
2014-03-08 00:42:42 +01:00
|
|
|
};
|
|
|
|
|
2020-08-29 01:28:51 +02:00
|
|
|
patches = [ (fetchpatch {
|
|
|
|
name = "hardened-udev-rules.patch";
|
|
|
|
url = "https://osmocom.org/projects/rtl-sdr/repository/revisions/b2814731563be4d5a0a68554ece6454a2c63af12/diff?format=diff";
|
|
|
|
sha256 = "0ns740s2rys4glq4la4bh0sxfv1mn61yfjns2yllhx70rsb2fqrn";
|
|
|
|
}) ];
|
|
|
|
|
2020-03-12 15:15:31 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig cmake ];
|
|
|
|
buildInputs = [ libusb1 ];
|
2014-03-08 00:42:42 +01:00
|
|
|
|
2014-10-30 08:26:19 +01: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 02:24:15 +02:00
|
|
|
postInstall = stdenv.lib.optionalString stdenv.isLinux ''
|
2014-03-08 00:42:42 +01:00
|
|
|
mkdir -p "$out/etc/udev/rules.d/"
|
|
|
|
cp ../rtl-sdr.rules "$out/etc/udev/rules.d/99-rtl-sdr.rules"
|
2014-10-30 08:26:19 +01: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 00:42:42 +01:00
|
|
|
'';
|
2018-12-09 11:18:13 +01:00
|
|
|
|
2014-03-08 00:42:42 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://sdr.osmocom.org/trac/wiki/rtl-sdr";
|
2014-03-08 00:42:42 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2017-07-15 02:24:15 +02:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2014-03-08 00:42:42 +01:00
|
|
|
maintainers = [ maintainers.bjornfor ];
|
|
|
|
};
|
|
|
|
}
|