1 { stdenv, lib, fetchurl, autoPatchelfHook, udev, libusb1 }:
4 if stdenv.isx86_64 then "x86_64"
5 else if stdenv.isi686 then "i686"
6 else if stdenv.isAarch64 then "aarch64"
7 else throw "unsupported architecture";
13 url = "https://www.sdrplay.com/software/SDRplay_RSP_API-ARM64-${version}.run";
14 hash = "sha256-GJPFW6W8Ke4mnczcSLFYfioOMGCfFn2/EIA07VnmVGY=";
18 url = "https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-${version}.run";
19 sha256 = "1a25c7rsdkcjxr7ffvx2lwj7fxdbslg9qhr8ghaq1r53rcrqgzmf";
25 stdenv.mkDerivation rec {
29 src = fetchurl srcs."${arch}";
31 nativeBuildInputs = [ autoPatchelfHook ];
33 buildInputs = [ libusb1 udev stdenv.cc.cc.lib ];
36 sh "$src" --noexec --target source
39 sourceRoot = "source";
44 mkdir -p $out/{bin,lib,include,lib/udev/rules.d}
45 majorVersion="${lib.concatStringsSep "." (lib.take 1 (builtins.splitVersion version))}"
46 majorMinorVersion="${lib.concatStringsSep "." (lib.take 2 (builtins.splitVersion version))}"
47 libName="libsdrplay_api"
48 cp "${arch}/$libName.so.$majorMinorVersion" $out/lib/
49 ln -s "$out/lib/$libName.so.$majorMinorVersion" "$out/lib/$libName.so.$majorVersion"
50 ln -s "$out/lib/$libName.so.$majorVersion" "$out/lib/$libName.so"
51 cp "${arch}/sdrplay_apiService" $out/bin/
52 cp -r inc/* $out/include/
53 cp 66-mirics.rules $out/lib/udev/rules.d/
57 description = "SDRplay API";
59 Proprietary library and api service for working with SDRplay devices. For documentation and licensing details see
60 https://www.sdrplay.com/docs/SDRplay_API_Specification_v${lib.concatStringsSep "." (lib.take 2 (builtins.splitVersion version))}.pdf
62 homepage = "https://www.sdrplay.com/downloads/";
63 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
64 license = licenses.unfree;
65 maintainers = with maintainers; [ pmenke zaninime ];
66 platforms = platforms.linux;
67 mainProgram = "sdrplay_apiService";