nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, darwin
4, mkDerivation
5, fetchgit
6, gnuradio
7, cmake
8, pkg-config
9, logLib
10, libsndfile
11, mpir
12, boost
13, gmp
14, thrift
15, fftwFloat
16, python
17, swig
18, uhd
19, icu
20, airspy
21, hackrf
22, libbladeRF
23, rtl-sdr
24, soapysdr-with-plugins
25}:
26
27let
28 version = {
29 "3.7" = "0.1.5";
30 "3.8" = "0.2.3";
31 "3.9" = "0.2.4";
32 "3.10" = "0.2.4";
33 }.${gnuradio.versionAttr.major};
34 src = fetchgit {
35 url = "git://git.osmocom.org/gr-osmosdr";
36 rev = "v${version}";
37 sha256 = {
38 "3.7" = "0bf9bnc1c3c4yqqqgmg3nhygj6rcfmyk6pybi27f7461d2cw1drv";
39 "3.8" = "sha256-ZfI8MshhZOdJ1U5FlnZKXsg2Rsvb6oKg943ZVYd/IWo=";
40 "3.9" = "sha256-d0hbiJ44lEu8V4XX7JpZVSTQwwykwKPUfiqetRBI6uI=";
41 "3.10" = "sha256-d0hbiJ44lEu8V4XX7JpZVSTQwwykwKPUfiqetRBI6uI=";
42 }.${gnuradio.versionAttr.major};
43 };
44in mkDerivation {
45 pname = "gr-osmosdr";
46 inherit version src;
47 disabledForGRafter = "3.11";
48
49 outputs = [ "out" "dev" ];
50
51 buildInputs = [
52 logLib
53 mpir
54 boost
55 fftwFloat
56 gmp
57 icu
58 airspy
59 hackrf
60 libbladeRF
61 rtl-sdr
62 soapysdr-with-plugins
63 ] ++ lib.optionals (gnuradio.hasFeature "gr-blocks") [
64 libsndfile
65 ] ++ lib.optionals (gnuradio.hasFeature "gr-uhd") [
66 uhd
67 ] ++ lib.optionals (gnuradio.hasFeature "gr-ctrlport") [
68 thrift
69 python.pkgs.thrift
70 ] ++ lib.optionals (gnuradio.hasFeature "python-support") [
71 python.pkgs.numpy
72 python.pkgs.pybind11
73 ] ++ lib.optionals stdenv.isDarwin [
74 darwin.apple_sdk.frameworks.IOKit
75 darwin.apple_sdk.frameworks.Security
76 ];
77 cmakeFlags = [
78 (if (gnuradio.hasFeature "python-support") then
79 "-DENABLE_PYTHON=ON"
80 else
81 "-DENABLE_PYTHON=OFF"
82 )
83 ];
84 nativeBuildInputs = [
85 cmake
86 pkg-config
87 swig
88 ] ++ lib.optionals (gnuradio.hasFeature "python-support") [
89 (if (gnuradio.versionAttr.major == "3.7") then
90 python.pkgs.cheetah
91 else
92 python.pkgs.mako
93 )
94 python
95 ]
96 ;
97
98 meta = with lib; {
99 description = "Gnuradio block for OsmoSDR and rtl-sdr";
100 homepage = "https://sdr.osmocom.org/trac/wiki/GrOsmoSDR";
101 license = licenses.gpl3Plus;
102 maintainers = with maintainers; [ bjornfor ];
103 platforms = platforms.unix;
104 };
105}