tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
uhd: 3.15.0.0 -> 4.0.0.0
Doron Behar
5 years ago
4f2573e8
a3228bb6
+171
-8
3 changed files
expand all
collapse all
unified
split
pkgs
applications
radio
uhd
3.5.nix
default.nix
top-level
all-packages.nix
+159
pkgs/applications/radio/uhd/3.5.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{ lib
2
+
, stdenv
3
+
, fetchurl
4
+
, fetchFromGitHub
5
+
, cmake
6
+
, pkg-config
7
+
# See https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html for dependencies explanations
8
+
, boost
9
+
, enableLibuhd_C_api ? true
10
+
# requires numpy
11
+
, enableLibuhd_Python_api ? false
12
+
, python3
13
+
, enableExamples ? false
14
+
, enableUtils ? false
15
+
, enableLiberio ? false
16
+
, liberio
17
+
, libusb1
18
+
, enableDpdk ? false
19
+
, dpdk
20
+
# Devices
21
+
, enableOctoClock ? true
22
+
, enableMpmd ? true
23
+
, enableB100 ? true
24
+
, enableB200 ? true
25
+
, enableUsrp1 ? true
26
+
, enableUsrp2 ? true
27
+
, enableX300 ? true
28
+
, enableN230 ? true
29
+
, enableN300 ? true
30
+
, enableN320 ? true
31
+
, enableE300 ? true
32
+
, enableE320 ? true
33
+
}:
34
+
35
+
let
36
+
onOffBool = b: if b then "ON" else "OFF";
37
+
inherit (lib) optionals;
38
+
in
39
+
40
+
stdenv.mkDerivation rec {
41
+
pname = "uhd";
42
+
# UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz
43
+
# and xxx.yyy.zzz. Hrmpf... style keeps changing
44
+
version = "3.15.0.0";
45
+
46
+
src = fetchFromGitHub {
47
+
owner = "EttusResearch";
48
+
repo = "uhd";
49
+
rev = "v${version}";
50
+
sha256 = "0jknln88a69fh244670nb7qrflbyv0vvdxfddb5g8ncpb6hcg8qf";
51
+
};
52
+
# Firmware images are downloaded (pre-built) from the respective release on Github
53
+
uhdImagesSrc = fetchurl {
54
+
url = "https://github.com/EttusResearch/uhd/releases/download/v${version}/uhd-images_${version}.tar.xz";
55
+
sha256 = "1fir1a13ac07mqhm4sr34cixiqj2difxq0870qv1wr7a7cbfw6vp";
56
+
};
57
+
58
+
cmakeFlags = [
59
+
"-DENABLE_LIBUHD=ON"
60
+
"-DENABLE_USB=ON"
61
+
"-DENABLE_TESTS=ON" # This installs tests as well so we delete them via postPhases
62
+
"-DENABLE_EXAMPLES=${onOffBool enableExamples}"
63
+
"-DENABLE_UTILS=${onOffBool enableUtils}"
64
+
"-DENABLE_LIBUHD_C_API=${onOffBool enableLibuhd_C_api}"
65
+
"-DENABLE_LIBUHD_PYTHON_API=${onOffBool enableLibuhd_Python_api}"
66
+
"-DENABLE_LIBERIO=${onOffBool enableLiberio}"
67
+
"-DENABLE_DPDK=${onOffBool enableDpdk}"
68
+
# Devices
69
+
"-DENABLE_OCTOCLOCK=${onOffBool enableOctoClock}"
70
+
"-DENABLE_MPMD=${onOffBool enableMpmd}"
71
+
"-DENABLE_B100=${onOffBool enableB100}"
72
+
"-DENABLE_B200=${onOffBool enableB200}"
73
+
"-DENABLE_USRP1=${onOffBool enableUsrp1}"
74
+
"-DENABLE_USRP2=${onOffBool enableUsrp2}"
75
+
"-DENABLE_X300=${onOffBool enableX300}"
76
+
"-DENABLE_N230=${onOffBool enableN230}"
77
+
"-DENABLE_N300=${onOffBool enableN300}"
78
+
"-DENABLE_N320=${onOffBool enableN320}"
79
+
"-DENABLE_E300=${onOffBool enableE300}"
80
+
"-DENABLE_E320=${onOffBool enableE320}"
81
+
]
82
+
# TODO: Check if this still needed
83
+
# ABI differences GCC 7.1
84
+
# /nix/store/wd6r25miqbk9ia53pp669gn4wrg9n9cj-gcc-7.3.0/include/c++/7.3.0/bits/vector.tcc:394:7: note: parameter passing for argument of type 'std::vector<uhd::range_t>::iterator {aka __gnu_cxx::__normal_iterator<uhd::range_t*, std::vector<uhd::range_t> >}' changed in GCC 7.1
85
+
++ [ (lib.optionalString stdenv.isAarch32 "-DCMAKE_CXX_FLAGS=-Wno-psabi") ]
86
+
;
87
+
88
+
# Python + Mako are always required for the build itself but not necessary for runtime.
89
+
pythonEnv = python3.withPackages (ps: with ps; [ Mako ]
90
+
++ optionals (enableLibuhd_Python_api) [ numpy setuptools ]
91
+
++ optionals (enableUtils) [ requests six ]
92
+
);
93
+
94
+
nativeBuildInputs = [
95
+
cmake
96
+
pkg-config
97
+
]
98
+
# If both enableLibuhd_Python_api and enableUtils are off, we don't need
99
+
# pythonEnv in buildInputs as it's a 'build' dependency and not a runtime
100
+
# dependency
101
+
++ optionals (!enableLibuhd_Python_api && !enableUtils) [ pythonEnv ]
102
+
;
103
+
buildInputs = [
104
+
boost
105
+
libusb1
106
+
]
107
+
# However, if enableLibuhd_Python_api *or* enableUtils is on, we need
108
+
# pythonEnv for runtime as well. The utilities' runtime dependencies are
109
+
# handled at the environment
110
+
++ optionals (enableLibuhd_Python_api || enableUtils) [ pythonEnv ]
111
+
++ optionals (enableLiberio) [ liberio ]
112
+
++ optionals (enableDpdk) [ dpdk ]
113
+
;
114
+
115
+
doCheck = true;
116
+
117
+
# Build only the host software
118
+
preConfigure = "cd host";
119
+
# TODO: Check if this still needed, perhaps relevant:
120
+
# https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html#build_instructions_unix_arm
121
+
patches = if stdenv.isAarch32 then ./neon.patch else null;
122
+
123
+
postPhases = [ "installFirmware" "removeInstalledTests" ]
124
+
++ optionals (enableUtils) [ "moveUdevRules" ]
125
+
;
126
+
127
+
# UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images`
128
+
installFirmware = ''
129
+
mkdir -p "$out/share/uhd/images"
130
+
tar --strip-components=1 -xvf "${uhdImagesSrc}" -C "$out/share/uhd/images"
131
+
'';
132
+
133
+
# -DENABLE_TESTS=ON installs the tests, we don't need them in the output
134
+
removeInstalledTests = ''
135
+
rm -r $out/lib/uhd/tests
136
+
'';
137
+
138
+
# Moves the udev rules to the standard location, needed only if utils are
139
+
# enabled
140
+
moveUdevRules = ''
141
+
mkdir -p $out/lib/udev/rules.d
142
+
mv $out/lib/uhd/utils/uhd-usrp.rules $out/lib/udev/rules.d/
143
+
'';
144
+
145
+
meta = with lib; {
146
+
description = "USRP Hardware Driver (for Software Defined Radio)";
147
+
longDescription = ''
148
+
The USRP Hardware Driver (UHD) software is the hardware driver for all
149
+
USRP (Universal Software Radio Peripheral) devices.
150
+
151
+
USRP devices are designed and sold by Ettus Research, LLC and its parent
152
+
company, National Instruments.
153
+
'';
154
+
homepage = "https://uhd.ettus.com/";
155
+
license = licenses.gpl3Plus;
156
+
platforms = platforms.linux ++ platforms.darwin;
157
+
maintainers = with maintainers; [ bjornfor fpletz tomberek ];
158
+
};
159
+
}
+9
-8
pkgs/applications/radio/uhd/default.nix
···
1
-
{ lib, stdenv
0
2
, fetchurl
3
, fetchFromGitHub
4
, cmake
···
8
, enableLibuhd_C_api ? true
9
# requires numpy
10
, enableLibuhd_Python_api ? false
11
-
, python3 ? null
12
, enableExamples ? false
13
, enableUtils ? false
14
, enableLiberio ? false
15
-
, liberio ? null
16
-
, libusb1 ? null
17
, enableDpdk ? false
18
-
, dpdk ? null
19
# Devices
20
, enableOctoClock ? true
21
, enableMpmd ? true
···
40
pname = "uhd";
41
# UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz
42
# and xxx.yyy.zzz. Hrmpf... style keeps changing
43
-
version = "3.15.0.0";
44
45
src = fetchFromGitHub {
46
owner = "EttusResearch";
47
repo = "uhd";
48
rev = "v${version}";
49
-
sha256 = "0jknln88a69fh244670nb7qrflbyv0vvdxfddb5g8ncpb6hcg8qf";
50
};
51
# Firmware images are downloaded (pre-built) from the respective release on Github
52
uhdImagesSrc = fetchurl {
53
url = "https://github.com/EttusResearch/uhd/releases/download/v${version}/uhd-images_${version}.tar.xz";
54
-
sha256 = "1fir1a13ac07mqhm4sr34cixiqj2difxq0870qv1wr7a7cbfw6vp";
55
};
56
57
cmakeFlags = [
···
1
+
{ lib
2
+
, stdenv
3
, fetchurl
4
, fetchFromGitHub
5
, cmake
···
9
, enableLibuhd_C_api ? true
10
# requires numpy
11
, enableLibuhd_Python_api ? false
12
+
, python3
13
, enableExamples ? false
14
, enableUtils ? false
15
, enableLiberio ? false
16
+
, liberio
17
+
, libusb1
18
, enableDpdk ? false
19
+
, dpdk
20
# Devices
21
, enableOctoClock ? true
22
, enableMpmd ? true
···
41
pname = "uhd";
42
# UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz
43
# and xxx.yyy.zzz. Hrmpf... style keeps changing
44
+
version = "4.0.0.0";
45
46
src = fetchFromGitHub {
47
owner = "EttusResearch";
48
repo = "uhd";
49
rev = "v${version}";
50
+
sha256 = "NCyiI4pIPw0nBRFdUGpgZ/x2mWz+Qm78ZGACUnSbGSs=";
51
};
52
# Firmware images are downloaded (pre-built) from the respective release on Github
53
uhdImagesSrc = fetchurl {
54
url = "https://github.com/EttusResearch/uhd/releases/download/v${version}/uhd-images_${version}.tar.xz";
55
+
sha256 = "Xfx0bsHUQ5+Dp+xk0sVWWP83oyXQcUH5AX4PNEE7fY4=";
56
};
57
58
cmakeFlags = [
+3
pkgs/top-level/all-packages.nix
···
13141
13142
uefi-firmware-parser = callPackage ../development/tools/analysis/uefi-firmware-parser { };
13143
0
13144
uhd = callPackage ../applications/radio/uhd { };
13145
13146
uisp = callPackage ../development/tools/misc/uisp { };
···
22358
gnuradio3_7-unwrapped = callPackage ../applications/radio/gnuradio/3.7.nix {
22359
inherit (darwin.apple_sdk.frameworks) CoreAudio;
22360
python = python2;
0
0
22361
};
22362
# A build without gui components and other utilites not needed if gnuradio is
22363
# used as a c++ library.
···
13141
13142
uefi-firmware-parser = callPackage ../development/tools/analysis/uefi-firmware-parser { };
13143
13144
+
uhd3_5 = callPackage ../applications/radio/uhd/3.5.nix { };
13145
uhd = callPackage ../applications/radio/uhd { };
13146
13147
uisp = callPackage ../development/tools/misc/uisp { };
···
22359
gnuradio3_7-unwrapped = callPackage ../applications/radio/gnuradio/3.7.nix {
22360
inherit (darwin.apple_sdk.frameworks) CoreAudio;
22361
python = python2;
22362
+
# Incompatible with uhd4+
22363
+
uhd = uhd3_5;
22364
};
22365
# A build without gui components and other utilites not needed if gnuradio is
22366
# used as a c++ library.