rtl-sdr: refactor, add rtl-sdr-blog and set it as default

This commit is contained in:
Tungsten842 2024-04-14 17:48:34 +02:00 committed by Bjørn Forsman
parent be365f9dc9
commit a1080ded57
3 changed files with 88 additions and 85 deletions

View File

@ -1,45 +1,96 @@
{ lib
, stdenv
, fetchFromGitea
, fetchFromGitHub
, cmake
, pkg-config
, libusb1
}:
let
generic = { version, pname, src, meta }:
stdenv.mkDerivation {
inherit version pname src;
nativeBuildInputs = [ pkg-config cmake ];
propagatedBuildInputs = [ libusb1 ];
stdenv.mkDerivation rec {
pname = "rtl-sdr";
version = "0.9.0";
cmakeFlags = lib.optionals stdenv.isLinux [
"-DINSTALL_UDEV_RULES=ON"
"-DWITH_RPC=ON"
];
src = fetchFromGitHub {
owner = "librtlsdr";
repo = "librtlsdr";
rev = "v${version}";
hash = "sha256-I1rbywQ0ZBw26wZdtMBkfpj7+kv09XKrrcoDuhIkRmw=";
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace '/etc/udev/rules.d' "$out/etc/udev/rules.d" \
--replace "VERSION_INFO_PATCH_VERSION git" "VERSION_INFO_PATCH_VERSION ${lib.versions.patch version}"
substituteInPlace rtl-sdr.rules \
--replace 'MODE:="0666"' 'ENV{ID_SOFTWARE_RADIO}="1", MODE="0660", GROUP="plugdev"'
'';
meta = with lib; {
inherit (meta) longDescription homepage;
description = "Software to turn the RTL2832U into a SDR receiver";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ bjornfor skovati ];
platforms = platforms.unix;
mainProgram = "rtl_sdr";
};
};
in
{
rtl-sdr-osmocom = generic rec {
pname = "rtl-sdr-osmocom";
version = "2.0.1";
src = fetchFromGitea {
domain = "gitea.osmocom.org";
owner = "sdr";
repo = "rtl-sdr";
rev = "v${version}";
hash = "sha256-+RYSCn+wAkb9e7NRI5kLY8a6OXtJu7QcSUht1R6wDX0=";
};
meta = {
longDescription = "Rtl-sdr library by the Osmocom project";
homepage = "https://gitea.osmocom.org/sdr/rtl-sdr";
};
};
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace '/etc/udev/rules.d' "$out/etc/udev/rules.d" \
--replace "VERSION_INFO_PATCH_VERSION git" "VERSION_INFO_PATCH_VERSION ${lib.versions.patch version}"
rtl-sdr-librtlsdr = generic rec {
pname = "rtl-sdr-librtlsdr";
version = "0.9.0";
substituteInPlace rtl-sdr.rules \
--replace 'MODE:="0666"' 'ENV{ID_SOFTWARE_RADIO}="1", MODE="0660", GROUP="plugdev"'
'';
nativeBuildInputs = [ pkg-config cmake ];
propagatedBuildInputs = [ libusb1 ];
cmakeFlags = lib.optionals stdenv.isLinux [
"-DINSTALL_UDEV_RULES=ON"
"-DWITH_RPC=ON"
];
meta = with lib; {
description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
homepage = "https://github.com/librtlsdr/librtlsdr";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ bjornfor ];
platforms = platforms.linux ++ platforms.darwin;
src = fetchFromGitHub {
owner = "librtlsdr";
repo = "librtlsdr";
rev = "v${version}";
hash = "sha256-I1rbywQ0ZBw26wZdtMBkfpj7+kv09XKrrcoDuhIkRmw=";
};
meta = {
longDescription = ''
Fork of the rtl-sdr library by the Osmocom project. A list of differences
can be found here: https://github.com/librtlsdr/librtlsdr/blob/master/README_improvements.md
'';
homepage = "https://github.com/librtlsdr/librtlsdr";
};
};
rtl-sdr-blog = generic rec {
pname = "rtl-sdr-blog";
version = "1.3.5";
src = fetchFromGitHub {
owner = "rtlsdrblog";
repo = "rtl-sdr-blog";
rev = version;
hash = "sha256-7FpT+BoQ2U8KiKwX4NfEwrO3lMBti7RX8uKtT5dFH8M=";
};
meta = {
longDescription = ''
Fork of the rtl-sdr library by the Osmocom project. A list of differences
can be found here: https://github.com/rtlsdrblog/rtl-sdr-blog/blob/master/README
'';
homepage = "https://github.com/rtlsdrblog/rtl-sdr-blog";
};
};
}

View File

@ -1,53 +0,0 @@
{ lib
, stdenv
, fetchFromGitea
, cmake
, pkg-config
, libusb1
}:
stdenv.mkDerivation rec {
pname = "rtl-sdr-osmocom";
version = "2.0.1";
src = fetchFromGitea {
domain = "gitea.osmocom.org";
owner = "sdr";
repo = "rtl-sdr";
rev = "v${version}";
hash = "sha256-+RYSCn+wAkb9e7NRI5kLY8a6OXtJu7QcSUht1R6wDX0=";
};
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace '/etc/udev/rules.d' "$out/etc/udev/rules.d" \
--replace "VERSION_INFO_PATCH_VERSION git" "VERSION_INFO_PATCH_VERSION ${lib.versions.patch version}"
substituteInPlace rtl-sdr.rules \
--replace 'MODE:="0666"' 'ENV{ID_SOFTWARE_RADIO}="1", MODE="0660", GROUP="plugdev"'
'';
nativeBuildInputs = [ pkg-config cmake ];
propagatedBuildInputs = [ libusb1 ];
cmakeFlags = lib.optionals stdenv.isLinux [
"-DINSTALL_UDEV_RULES=ON"
"-DWITH_RPC=ON"
];
meta = with lib; {
description = "Software to turn the RTL2832U into a SDR receiver";
longDescription = ''
This packages the rtl-sdr library by the Osmocom project. This is the upstream codebase of the unsuffixed "rtl-sdr" package, which is a downstream fork. A list of differences can be found here:
https://github.com/librtlsdr/librtlsdr/blob/master/README_improvements.md
The Osmocom upstream has a regular release schedule, so this package will likely support newer SDR dongles. It should be compatible with most software that currently depends on the "rtl-sdr" nixpkg, but comptabiliy should be manually confirmed.
'';
homepage = "https://gitea.osmocom.org/sdr/rtl-sdr";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ skovati ];
platforms = platforms.unix;
mainProgram = "rtl_sdr";
};
}

View File

@ -34417,7 +34417,12 @@ with pkgs;
rtl-ais = callPackage ../applications/radio/rtl-ais { };
rtl-sdr = callPackage ../applications/radio/rtl-sdr { };
inherit (callPackages ../applications/radio/rtl-sdr { })
rtl-sdr-librtlsdr
rtl-sdr-osmocom
rtl-sdr-blog;
rtl-sdr = rtl-sdr-blog;
rubyripper = callPackage ../applications/audio/rubyripper { };