91c4571e4f
This patch partially fixes #81985. Cross-compiling rtl-sdr is possible using this patch. Use nix build -f <nixpkgs-path> -A pkgsCross.raspberryPi.rtl-sdr to build rtl-sdr. The error that occured when trying to do this before was as follows: /nix/store/ldb2v2z0198abkp2minr9a9vz5np4mn4-cmake-3.16.4-armv6l-unknown-linux-gnueabihf/nix-support/setup-hook: line 107: cmake: command not found
37 lines
1.3 KiB
Nix
37 lines
1.3 KiB
Nix
{ stdenv, fetchgit, cmake, pkgconfig, libusb1 }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "rtl-sdr";
|
|
version = "0.6.0";
|
|
|
|
src = fetchgit {
|
|
url = "git://git.osmocom.org/rtl-sdr.git";
|
|
rev = "refs/tags/${version}";
|
|
sha256 = "0lmvsnb4xw4hmz6zs0z5ilsah5hjz29g1s0050n59fllskqr3b8k";
|
|
};
|
|
|
|
nativeBuildInputs = [ pkgconfig cmake ];
|
|
buildInputs = [ 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 = stdenv.lib.optionalString stdenv.isLinux ''
|
|
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 ++ platforms.darwin;
|
|
maintainers = [ maintainers.bjornfor ];
|
|
};
|
|
}
|