2021-04-17 00:35:05 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-04-27 09:35:20 +00:00
|
|
|
, fetchFromGitHub
|
2021-04-17 00:35:05 +00:00
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, libusb1
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rtl-sdr";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "0.8.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "librtlsdr";
|
|
|
|
repo = "librtlsdr";
|
|
|
|
rev = "v${version}";
|
2023-02-22 10:55:15 +00:00
|
|
|
hash = "sha256-s03h+3EfC5c7yRYBM6aCRWtmstwRJWuBywuyVt+k/bk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-17 00:35:05 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace '/etc/udev/rules.d' "$out/etc/udev/rules.d"
|
|
|
|
|
|
|
|
substituteInPlace rtl-sdr.rules \
|
|
|
|
--replace 'MODE:="0666"' 'ENV{ID_SOFTWARE_RADIO}="1", MODE="0660", GROUP="plugdev"'
|
|
|
|
'';
|
2020-10-27 00:29:36 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config cmake ];
|
2021-04-17 00:35:05 +00:00
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
propagatedBuildInputs = [ libusb1 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
cmakeFlags = lib.optionals stdenv.isLinux [
|
2022-04-27 09:35:20 +00:00
|
|
|
"-DINSTALL_UDEV_RULES=ON"
|
|
|
|
"-DWITH_RPC=ON"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
|
2021-04-18 02:13:31 +00:00
|
|
|
homepage = "https://github.com/librtlsdr/librtlsdr";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2021-04-17 00:35:05 +00:00
|
|
|
maintainers = with maintainers; [ bjornfor ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
};
|
|
|
|
}
|