{ alsa-lib, autoPatchelfHook, copyDesktopItems, fetchurl, fontconfig, gcc, iconConvTools, icu, lib, libusb1, makeDesktopItem, stdenv, util-linux, xorg }: let hash = "b6fce59a3"; platforms = { aarch64-linux = { arch = "arm64"; sha256 = "8d354686700014c4bd606a959ee5e979b0601bef281a33c8d12e181819d9a641"; }; x86_64-linux = { arch = "x64"; sha256 = "1c2d150df1aec3f15174986fe7f522ea98aa04f3536f941fcc98f099a798b835"; }; }; version = "1.0.3"; inherit (stdenv.hostPlatform) system; in with platforms.${system} or (throw "Unsupported system: ${system}"); stdenv.mkDerivation rec { pname = "sdrconnect"; src = fetchurl { url = "https://www.sdrplay.com/software/SDRconnect_linux-${arch}_${hash}.run"; inherit sha256; }; nativeBuildInputs = [ autoPatchelfHook copyDesktopItems iconConvTools ]; buildInputs = [ alsa-lib fontconfig libusb1 util-linux # for libuuid gcc.cc.lib # for libstdc++ ]; runtimeDependencies = [ icu xorg.libX11 xorg.libICE xorg.libSM ]; appendRunpaths = [ "${placeholder "out"}/lib" ]; unpackPhase = '' bash $src --target . --noexec ''; postInstall = '' mkdir -p $out/bin $out/lib cp SDRconnect $out/bin cp *.so $out/lib icoFileToHiColorTheme sdrconnect.ico sdrconnect $out ''; desktopItems = with meta; [ (makeDesktopItem { name = pname; icon = pname; exec = mainProgram; comment = description; desktopName = "SDRconnect"; genericName = "SDRplay Client"; categories = [ "HamRadio" ]; keywords = [ "Ham" "Radio" "SDR" ]; }) ]; meta = with lib; { description = "Cross platform GUI client for SDRplay"; homepage = "https://www.sdrplay.com/sdrconnect/"; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; platforms = attrNames platforms; mainProgram = "SDRconnect"; }; }