default.nix (2117B)
1 { 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 fftwFloat, 7 libsamplerate, 8 libsndfile, 9 libusb1, 10 portaudio, 11 rtl-sdr, 12 qmake, 13 qwt, 14 wrapQtAppsHook, 15 }: 16 17 stdenv.mkDerivation (finalAttrs: { 18 pname = "fmreceiver"; 19 version = "2.1"; 20 21 src = fetchFromGitHub { 22 owner = "JvanKatwijk"; 23 repo = "sdr-j-fm"; 24 rev = finalAttrs.version; 25 hash = "sha256-U0m9PIB+X+TBoz5FfXMvR/tZjkNIy7B613I7eLT5UIs="; 26 }; 27 28 patches = [ 29 # support qwt-6.2.0 30 (fetchpatch { 31 url = "https://github.com/JvanKatwijk/sdr-j-fm/commit/4ca2f3a28e3e3460dc95be851fcd923e91488573.patch"; 32 hash = "sha256-tjNsg9Rc8kBn+6UzPsf1WLt+ZRYv8neG/CSyZKjObh0="; 33 }) 34 ]; 35 36 postPatch = 37 '' 38 substituteInPlace fmreceiver.pro \ 39 --replace-fail "-lqwt-qt5" "-lqwt" \ 40 --replace-fail "CONFIG" "#CONFIG" 41 '' 42 + lib.optionalString stdenv.isDarwin '' 43 substituteInPlace fmreceiver.pro --replace-fail "-lrt " "" 44 substituteInPlace includes/fm-constants.h --replace-fail "<malloc.h>" "<stdlib.h>" 45 substituteInPlace devices/rtlsdr-handler/rtlsdr-handler.cpp --replace-fail ".so" ".dylib" 46 ''; 47 48 nativeBuildInputs = [ 49 qmake 50 wrapQtAppsHook 51 ]; 52 53 buildInputs = [ 54 fftwFloat 55 libsamplerate 56 libsndfile 57 libusb1 58 portaudio 59 qwt 60 ]; 61 62 qmakeFlags = [ "CONFIG+=dabstick" ]; 63 64 qtWrapperArgs = [ 65 "--prefix ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH : ${ 66 lib.makeLibraryPath [ rtl-sdr ] 67 }" 68 ]; 69 70 installPhase = 71 if stdenv.isDarwin then 72 '' 73 mkdir -p $out/Applications 74 mv linux-bin/fmreceiver-2.0.app $out/Applications/fmreceiver.app 75 install_name_tool -change {,${qwt}/lib/}libqwt.6.dylib "$out/Applications/fmreceiver.app/Contents/MacOS/fmreceiver-2.0" 76 '' 77 else 78 '' 79 install -Dm755 linux-bin/fmreceiver-2.0 $out/bin/fmreceiver 80 ''; 81 82 meta = { 83 description = "A simple FM receiver"; 84 homepage = "https://github.com/JvanKatwijk/sdr-j-fm"; 85 license = lib.licenses.gpl2Plus; 86 maintainers = [ lib.maintainers.sikmir ]; 87 platforms = lib.platforms.unix; 88 }; 89 })