1{
2 lib,
3 mkDerivation,
4 fetchgit,
5 gnuradio,
6 cmake,
7 pkg-config,
8 logLib,
9 mpir,
10 gmp,
11 boost,
12 libGL,
13 opencl-headers,
14 ocl-icd,
15 freetype,
16 fftwFloat,
17 qt5,
18 python,
19 enableGLFW ? true,
20 glfw3,
21 enablePNG ? true,
22 libpng,
23 gnuradioOlder,
24 gnuradioAtLeast,
25}:
26
27mkDerivation {
28 pname = "gr-fosphor";
29 version = "unstable-2024-03-23";
30
31 # It is a gitea instance, but its archive service doesn't work very well so
32 # we can't use it.
33 src = fetchgit {
34 url = "https://gitea.osmocom.org/sdr/gr-fosphor.git";
35 rev = "74d54fc0b3ec9aeb7033686526c5e766f36eaf24";
36 hash = "sha256-FBmH4DmKATl0FPFU7T30OrYYmxlSTTLm1SZpt0o1qkw=";
37 };
38 disabled = gnuradioOlder "3.9" || gnuradioAtLeast "3.11";
39
40 nativeBuildInputs = [
41 cmake
42 pkg-config
43 ]
44 ++ lib.optionals (gnuradio.hasFeature "gr-qtgui") [
45 qt5.wrapQtAppsHook
46 ];
47
48 buildInputs = [
49 logLib
50 mpir
51 gmp
52 boost
53 libGL
54 opencl-headers
55 ocl-icd
56 freetype
57 fftwFloat
58 ]
59 ++ lib.optionals (gnuradio.hasFeature "gr-qtgui") [
60 qt5.qtbase
61 ]
62 ++ lib.optionals (gnuradio.hasFeature "python-support") [
63 python.pkgs.pybind11
64 python.pkgs.numpy
65 ]
66 ++ lib.optionals enableGLFW [
67 glfw3
68 ]
69 ++ lib.optionals enablePNG [
70 libpng
71 ];
72
73 cmakeFlags = [
74 (lib.cmakeBool "ENABLE_QT" (gnuradio.hasFeature "gr-qtgui"))
75 (lib.cmakeBool "ENABLE_PYTHON" (gnuradio.hasFeature "python-support"))
76 (lib.cmakeBool "ENABLE_GLFW" enableGLFW)
77 (lib.cmakeBool "ENABLE_PNG" enablePNG)
78 ];
79
80 meta = {
81 description = "GNU Radio block for RTSA-like spectrum visualization using OpenCL and OpenGL acceleration";
82 longDescription = ''
83 You'll need to install an OpenCL ICD for it to work.
84 See https://nixos.org/manual/nixos/stable/#sec-gpu-accel-opencl
85 '';
86 homepage = "https://projects.osmocom.org/projects/sdr/wiki/Fosphor";
87 license = lib.licenses.gpl3Plus;
88 maintainers = with lib.maintainers; [ chuangzhu ];
89 platforms = lib.platforms.linux;
90 };
91}