1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 fftw,
8 hamlib,
9 libpulseaudio,
10 libGL,
11 libX11,
12 liquid-dsp,
13 pkg-config,
14 soapysdr-with-plugins,
15 wxGTK32,
16 enableDigitalLab ? false,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "cubicsdr";
21 version = "0.2.7";
22
23 src = fetchFromGitHub {
24 owner = "cjcliffe";
25 repo = "CubicSDR";
26 rev = version;
27 sha256 = "0cyv1vk97x4i3h3hhh7dx8mv6d1ad0fypdbx5fl26bz661sr8j2n";
28 };
29
30 patches = [
31 # Fix for liquid-dsp v1.50
32 (fetchpatch {
33 url = "https://github.com/cjcliffe/CubicSDR/commit/0e3a785bd2af56d18ff06b56579197b3e89b34ab.patch";
34 sha256 = "sha256-mPfNZcV3FnEtGVX4sCMSs+Qc3VeSBIRkpCyx24TKkcU=";
35 })
36 ];
37
38 nativeBuildInputs = [
39 cmake
40 pkg-config
41 ];
42
43 buildInputs = [
44 fftw
45 hamlib
46 liquid-dsp
47 soapysdr-with-plugins
48 wxGTK32
49 ]
50 ++ lib.optionals stdenv.hostPlatform.isLinux [
51 libpulseaudio
52 libGL
53 libX11
54 ];
55
56 cmakeFlags = [ "-DUSE_HAMLIB=ON" ] ++ lib.optional enableDigitalLab "-DENABLE_DIGITAL_LAB=ON";
57
58 postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
59 install_name_tool -change libliquid.dylib ${lib.getLib liquid-dsp}/lib/libliquid.dylib ''${out}/bin/CubicSDR
60 '';
61
62 meta = with lib; {
63 homepage = "https://cubicsdr.com";
64 description = "Software Defined Radio application";
65 license = licenses.gpl2Plus;
66 maintainers = with maintainers; [ lasandell ];
67 platforms = platforms.unix;
68 mainProgram = "CubicSDR";
69 };
70}