package.nix (1934B)
1 { 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fftwFloat, 6 libsamplerate, 7 libsndfile, 8 libusb1, 9 portaudio, 10 rtl-sdr, 11 qt6, 12 qt6Packages, 13 wrapGAppsHook3, 14 }: 15 16 stdenv.mkDerivation (finalAttrs: { 17 pname = "fmreceiver"; 18 version = "3.20"; 19 20 __structuredAttrs = true; 21 22 src = fetchFromGitHub { 23 owner = "JvanKatwijk"; 24 repo = "sdr-j-fm"; 25 tag = finalAttrs.version; 26 hash = "sha256-qNSmBVY1n5+DR9k1d+nY11gBrYS7Ah774R2FMgCR4ks="; 27 }; 28 29 postPatch = '' 30 substituteInPlace fmreceiver.pro --replace-fail "CONFIG" "#CONFIG" 31 '' 32 + lib.optionalString stdenv.isDarwin '' 33 substituteInPlace fmreceiver.pro --replace-fail "-lrt " "" 34 substituteInPlace includes/fm-constants.h --replace-fail "<malloc.h>" "<stdlib.h>" 35 substituteInPlace devices/rtlsdr-handler/rtlsdr-handler.cpp --replace-fail ".so" ".dylib" 36 ''; 37 38 nativeBuildInputs = [ 39 qt6.qmake 40 qt6.wrapQtAppsHook 41 wrapGAppsHook3 # required for FileChooser 42 ]; 43 44 buildInputs = [ 45 fftwFloat 46 libsamplerate 47 libsndfile 48 libusb1 49 portaudio 50 qt6Packages.qwt 51 ]; 52 53 qmakeFlags = [ "CONFIG+=dabstick" ]; 54 55 gappsWrapperArgs = [ 56 "--prefix ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH : ${ 57 lib.makeLibraryPath [ rtl-sdr ] 58 }" 59 ]; 60 61 env.NIX_LDFLAGS = "-lqwt"; 62 63 installPhase = 64 if stdenv.isDarwin then 65 '' 66 mkdir -p $out/Applications 67 mv linux-bin/fmreceiver-3.20.app $out/Applications/fmreceiver.app 68 install_name_tool -change {,${qt6Packages.qwt}/lib/}libqwt.6.dylib "$out/Applications/fmreceiver.app/Contents/MacOS/fmreceiver-3.20" 69 '' 70 else 71 '' 72 install -Dm755 linux-bin/fmreceiver-3.20 $out/bin/fmreceiver 73 ''; 74 75 meta = { 76 description = "A simple FM receiver"; 77 homepage = "https://github.com/JvanKatwijk/sdr-j-fm"; 78 license = lib.licenses.gpl2Plus; 79 maintainers = [ lib.maintainers.sikmir ]; 80 platforms = lib.platforms.unix; 81 }; 82 })
