11 if stdenv.hostPlatform.isx86_64 then
13 else if stdenv.hostPlatform.isi686 then
15 else if stdenv.hostPlatform.isAarch64 then
18 throw "unsupported architecture";
24 url = "https://www.sdrplay.com/software/SDRplay_RSP_API-ARM64-${version}.run";
25 hash = "sha256-GJPFW6W8Ke4mnczcSLFYfioOMGCfFn2/EIA07VnmVGY=";
29 url = "https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-${version}.run";
30 sha256 = "1a25c7rsdkcjxr7ffvx2lwj7fxdbslg9qhr8ghaq1r53rcrqgzmf";
36 stdenv.mkDerivation rec {
40 src = fetchurl srcs."${arch}";
42 nativeBuildInputs = [ autoPatchelfHook ];
47 (lib.getLib stdenv.cc.cc)
51 sh "$src" --noexec --target source
54 sourceRoot = "source";
59 mkdir -p $out/{bin,lib,include,lib/udev/rules.d}
60 majorVersion="${lib.concatStringsSep "." (lib.take 1 (builtins.splitVersion version))}"
61 majorMinorVersion="${lib.concatStringsSep "." (lib.take 2 (builtins.splitVersion version))}"
62 libName="libsdrplay_api"
63 cp "${arch}/$libName.so.$majorMinorVersion" $out/lib/
64 ln -s "$out/lib/$libName.so.$majorMinorVersion" "$out/lib/$libName.so.$majorVersion"
65 ln -s "$out/lib/$libName.so.$majorVersion" "$out/lib/$libName.so"
66 cp "${arch}/sdrplay_apiService" $out/bin/
67 cp -r inc/* $out/include/
68 cp 66-mirics.rules $out/lib/udev/rules.d/
72 description = "SDRplay API";
74 Proprietary library and api service for working with SDRplay devices. For documentation and licensing details see
75 https://www.sdrplay.com/docs/SDRplay_API_Specification_v${lib.concatStringsSep "." (lib.take 2 (builtins.splitVersion version))}.pdf
77 homepage = "https://www.sdrplay.com/downloads/";
78 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
79 license = licenses.unfree;
80 maintainers = with maintainers; [
84 platforms = platforms.linux;
85 mainProgram = "sdrplay_apiService";