4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
44 lines
1.6 KiB
Nix
44 lines
1.6 KiB
Nix
{ lib, stdenv, fetchgit, fetchpatch, 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";
|
|
};
|
|
|
|
patches = [ (fetchpatch {
|
|
name = "hardened-udev-rules.patch";
|
|
url = "https://osmocom.org/projects/rtl-sdr/repository/revisions/b2814731563be4d5a0a68554ece6454a2c63af12/diff?format=diff";
|
|
sha256 = "0ns740s2rys4glq4la4bh0sxfv1mn61yfjns2yllhx70rsb2fqrn";
|
|
}) ];
|
|
|
|
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 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 ];
|
|
};
|
|
}
|