2021-01-17 02:09:27 +00:00
|
|
|
{ lib, stdenv, fetchgit, fetchpatch, cmake, pkg-config, libusb1 }:
|
2014-03-07 23:42:42 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "rtl-sdr";
|
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
|
|
|
};
|
|
|
|
|
2020-08-29 00:28:51 +01:00
|
|
|
patches = [ (fetchpatch {
|
|
|
|
name = "hardened-udev-rules.patch";
|
|
|
|
url = "https://osmocom.org/projects/rtl-sdr/repository/revisions/b2814731563be4d5a0a68554ece6454a2c63af12/diff?format=diff";
|
|
|
|
sha256 = "0ns740s2rys4glq4la4bh0sxfv1mn61yfjns2yllhx70rsb2fqrn";
|
|
|
|
}) ];
|
|
|
|
|
2021-01-17 02:09:27 +00:00
|
|
|
nativeBuildInputs = [ pkg-config cmake ];
|
2020-03-12 14:15:31 +00:00
|
|
|
buildInputs = [ 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.
|
2021-01-15 05:42:41 +00:00
|
|
|
postInstall = 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
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2014-03-07 23:42:42 +00:00
|
|
|
description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://sdr.osmocom.org/trac/wiki/rtl-sdr";
|
2014-03-07 23:42:42 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|