1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 wrapQtAppsHook,
7 pkg-config,
8 qtbase,
9 qwt6_1,
10 fftwFloat,
11 libsamplerate,
12 portaudio,
13 libusb1,
14 libsndfile,
15 featuresOverride ? { },
16}:
17
18stdenv.mkDerivation (finalAttrs: {
19 pname = "sdr-j-fm";
20 # The stable release doen't include the commit the came after 3.16 which
21 # added support for cmake options instead of using cmake set() commands. See
22 # also: https://github.com/JvanKatwijk/sdr-j-fm/pull/25
23 version = "3.16-unstable-2023-12-07";
24
25 src = fetchFromGitHub {
26 owner = "JvanKatwijk";
27 repo = "sdr-j-fm";
28 rev = "8e3a67f8fbf72dd6968cbeb2e3d7d513fd107c71";
29 hash = "sha256-l9WqfhDp2V01lhleYZqRpmyL1Ww+tJj10bjkMMlvyA0=";
30 };
31
32 nativeBuildInputs = [
33 cmake
34 wrapQtAppsHook
35 pkg-config
36 ];
37
38 buildInputs = [
39 qtbase
40 qwt6_1
41 fftwFloat
42 libsamplerate
43 portaudio
44 libusb1
45 libsndfile
46 ];
47 cmakeFlags = lib.mapAttrsToList lib.cmakeBool finalAttrs.passthru.features;
48
49 passthru = {
50 features = {
51 # All of these features don't require an external dependencies, although it
52 # may be implied - upstraem bundles everything they need in their repo.
53 AIRSPY = true;
54 SDRPLAY = true;
55 SDRPLAY_V3 = true;
56 HACKRF = true;
57 PLUTO = true;
58 # Some more cmake flags are mentioned in upstream's CMakeLists.txt file
59 # but they don't actually make a difference.
60 }
61 // featuresOverride;
62 };
63
64 postInstall = ''
65 # Weird default of upstream
66 mv $out/linux-bin $out/bin
67 '';
68
69 meta = with lib; {
70 description = "SDR based FM radio receiver software";
71 homepage = "https://github.com/JvanKatwijk/sdr-j-fm";
72 license = licenses.gpl2Only;
73 maintainers = with maintainers; [ doronbehar ];
74 # Upstream doesn't find libusb1 on Darwin. Upstream probably doesn't
75 # support it officially.
76 platforms = platforms.linux;
77 };
78})