1 { stdenv, lib, fetchFromGitHub, cmake, pkg-config
2 , libX11, glfw, glew, fftwFloat, volk, zstd, AppKit
4 , airspy_source ? true, airspy
5 , airspyhf_source ? true, airspyhf
6 , bladerf_source ? true, libbladeRF
8 , hackrf_source ? true, hackrf
9 , limesdr_source ? true, limesuite
10 , perseus_source ? false # needs libperseus-sdr, not yet available in nixpks
11 , plutosdr_source ? stdenv.isLinux, libiio, libad9361
12 , rfspace_source ? true
13 , rtl_sdr_source ? true, rtl-sdr-osmocom, libusb1 # osmocom better w/ rtlsdr v4
14 , rtl_tcp_source ? true
15 , sdrplay_source ? false, sdrplay
16 , soapy_source ? true, soapysdr
17 , spyserver_source ? true
18 , usrp_source ? false, uhd, boost
21 , audio_sink ? true, rtaudio
23 , portaudio_sink ? false, portaudio
26 , falcon9_decoder ? false
27 , m17_decoder ? false, codec2
28 , meteor_demodulator ? true
30 , weather_sat_decoder ? false # is missing some dsp/pll.h
33 , discord_presence ? true
34 , frequency_manager ? true
36 , rigctl_server ? true
40 stdenv.mkDerivation rec {
43 # SDR++ uses a rolling release model.
44 # Choose a git hash from head and use the date from that commit as
46 git_hash = "27ab5bf3c194169ddf60ca312723fce96149cc8e";
47 git_date = "2024-01-22";
48 version = "1.1.0-unstable-" + git_date;
50 src = fetchFromGitHub {
51 owner = "AlexandreRouma";
54 hash = "sha256-R4xWeqdHEAaje37VQaGlg+L2iYIOH4tXMHvZkZq4SDU=";
57 patches = [ ./runtime-prefix.patch ];
60 substituteInPlace CMakeLists.txt \
61 --replace "/usr/share" "share" \
62 --replace "set(CMAKE_INSTALL_PREFIX" "#set(CMAKE_INSTALL_PREFIX"
63 substituteInPlace decoder_modules/m17_decoder/src/m17dsp.h \
64 --replace "codec2.h" "codec2/codec2.h"
65 # Since the __TIME_ and __DATE__ is canonicalized in the build,
66 # use our qualified version shown in the programs window title.
67 substituteInPlace core/src/version.h --replace "1.1.0" "$version"
70 nativeBuildInputs = [ cmake pkg-config ];
72 buildInputs = [ glfw glew fftwFloat volk zstd ]
73 ++ lib.optional stdenv.isDarwin AppKit
74 ++ lib.optional stdenv.isLinux libX11
75 ++ lib.optional airspy_source airspy
76 ++ lib.optional airspyhf_source airspyhf
77 ++ lib.optional bladerf_source libbladeRF
78 ++ lib.optional hackrf_source hackrf
79 ++ lib.optional limesdr_source limesuite
80 ++ lib.optionals rtl_sdr_source [ rtl-sdr-osmocom libusb1 ]
81 ++ lib.optional sdrplay_source sdrplay
82 ++ lib.optional soapy_source soapysdr
83 ++ lib.optionals plutosdr_source [ libiio libad9361 ]
84 ++ lib.optionals usrp_source [ uhd boost ]
85 ++ lib.optional audio_sink rtaudio
86 ++ lib.optional portaudio_sink portaudio
87 ++ lib.optional m17_decoder codec2;
91 (lib.cmakeBool "OPT_BUILD_AIRSPYHF_SOURCE" airspyhf_source)
92 (lib.cmakeBool "OPT_BUILD_AIRSPY_SOURCE" airspy_source)
93 (lib.cmakeBool "OPT_BUILD_BLADERF_SOURCE" bladerf_source)
94 (lib.cmakeBool "OPT_BUILD_FILE_SOURCE" file_source)
95 (lib.cmakeBool "OPT_BUILD_HACKRF_SOURCE" hackrf_source)
96 (lib.cmakeBool "OPT_BUILD_LIMESDR_SOURCE" limesdr_source)
97 (lib.cmakeBool "OPT_BUILD_PERSEUS_SOURCE" perseus_source)
98 (lib.cmakeBool "OPT_BUILD_PLUTOSDR_SOURCE" plutosdr_source)
99 (lib.cmakeBool "OPT_BUILD_RFSPACE_SOURCE" rfspace_source)
100 (lib.cmakeBool "OPT_BUILD_RTL_SDR_SOURCE" rtl_sdr_source)
101 (lib.cmakeBool "OPT_BUILD_RTL_TCP_SOURCE" rtl_tcp_source)
102 (lib.cmakeBool "OPT_BUILD_SDRPLAY_SOURCE" sdrplay_source)
103 (lib.cmakeBool "OPT_BUILD_SOAPY_SOURCE" soapy_source)
104 (lib.cmakeBool "OPT_BUILD_SPYSERVER_SOURCE" spyserver_source)
105 (lib.cmakeBool "OPT_BUILD_USRP_SOURCE" usrp_source)
108 (lib.cmakeBool "OPT_BUILD_AUDIO_SINK" audio_sink)
109 (lib.cmakeBool "OPT_BUILD_NETWORK_SINK" network_sink)
110 (lib.cmakeBool "OPT_BUILD_NEW_PORTAUDIO_SINK" portaudio_sink)
113 (lib.cmakeBool "OPT_BUILD_FALCON9_DECODER" falcon9_decoder)
114 (lib.cmakeBool "OPT_BUILD_M17_DECODER" m17_decoder)
115 (lib.cmakeBool "OPT_BUILD_METEOR_DEMODULATOR" meteor_demodulator)
116 (lib.cmakeBool "OPT_BUILD_RADIO" radio)
117 (lib.cmakeBool "OPT_BUILD_WEATHER_SAT_DECODER" weather_sat_decoder)
120 (lib.cmakeBool "OPT_BUILD_DISCORD_PRESENCE" discord_presence)
121 (lib.cmakeBool "OPT_BUILD_FREQUENCY_MANAGER" frequency_manager)
122 (lib.cmakeBool "OPT_BUILD_RECORDER" recorder)
123 (lib.cmakeBool "OPT_BUILD_RIGCTL_SERVER" rigctl_server)
124 (lib.cmakeBool "OPT_BUILD_SCANNER" scanner)
127 env.NIX_CFLAGS_COMPILE = "-fpermissive";
129 hardeningDisable = lib.optional stdenv.cc.isClang "format";
132 description = "Cross-Platform SDR Software";
133 homepage = "https://github.com/AlexandreRouma/SDRPlusPlus";
134 license = licenses.gpl3Only;
135 platforms = platforms.unix;
136 maintainers = with maintainers; [ sikmir ];
137 mainProgram = "sdrpp";