2016-03-22 01:15:40 +01:00
{ stdenv , fetchurl , fetchFromGitHub , cmake , pkgconfig
, python , pythonPackages , orc , libusb1 , boost } :
2013-05-02 15:27:11 +02:00
# You need these udev rules to not have to run as root (copied from
# ${uhd}/share/uhd/utils/uhd-usrp.rules):
#
# SUBSYSTEMS=="usb", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0002", MODE:="0666"
# SUBSYSTEMS=="usb", ATTRS{idVendor}=="2500", ATTRS{idProduct}=="0002", MODE:="0666"
2018-02-01 20:43:40 +01:00
let
2018-03-29 03:14:08 +02:00
uhdVer = " v " + version ;
ImgVer = " u h d - i m a g e s _ 3 . 1 1 . 0 . g i t - 2 2 7 - g 9 2 7 7 f c 5 8 . t a r . x z " ;
2013-05-02 15:27:11 +02:00
# UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz
2018-03-29 03:14:08 +02:00
# and xxx.yyy.zzz. Hrmpf... style keeps changing
version = " 3 . 1 1 . 0 . 0 " ;
2018-02-01 20:43:40 +01:00
# Firmware images are downloaded (pre-built) from:
# http://files.ettus.com/binaries/images/
uhdImagesSrc = fetchurl {
2018-03-29 03:14:08 +02:00
url = " h t t p : / / f i l e s . e t t u s . c o m / b i n a r i e s / i m a g e s / ${ ImgVer } " ;
sha256 = " 1 z 8 i s n l x c 5 h 0 1 6 8 j j p d v d v 7 r k d 5 5 x 4 d k f h 1 4 m 8 p c 5 0 1 z s f 8 a z d 6 z " ;
2018-02-01 20:43:40 +01:00
} ;
in stdenv . mkDerivation {
name = " u h d - ${ version } " ;
2013-05-02 15:27:11 +02:00
2016-03-22 01:15:40 +01:00
src = fetchFromGitHub {
owner = " E t t u s R e s e a r c h " ;
repo = " u h d " ;
2018-03-29 03:14:08 +02:00
rev = " ${ uhdVer } " ;
sha256 = " 1 i l x 1 a 8 k 5 z y g f q 7 a c m 9 y k 2 f i 3 6 8 b 1 a 1 l 7 l l 2 1 k m m x j v 6 i f z 8 d s 5 q " ;
2013-05-02 15:27:11 +02:00
} ;
2016-03-22 01:15:40 +01:00
enableParallelBuilding = true ;
2018-03-29 03:14:08 +02:00
# ABI differences GCC 7.1
# /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
cmakeFlags = [ " - D L I B U S B _ I N C L U D E _ D I R S = ${ libusb1 . dev } / i n c l u d e / l i b u s b - 1 . 0 " ] ++
[ ( stdenv . lib . optionalString stdenv . isArm " - D C M A K E _ C X X _ F L A G S = - W n o - p s a b i " ) ] ;
2013-05-02 15:27:11 +02:00
2016-03-22 01:15:40 +01:00
nativeBuildInputs = [ cmake pkgconfig ] ;
buildInputs = [ python pythonPackages . pyramid_mako orc libusb1 boost ] ;
2013-05-02 15:27:11 +02:00
# Build only the host software
preConfigure = " c d h o s t " ;
2018-03-29 03:14:08 +02:00
patches = if stdenv . isArm then ./neon.patch else null ;
2013-05-02 15:27:11 +02:00
postPhases = [ " i n s t a l l F i r m w a r e " ] ;
installFirmware = ''
tar - - strip-components = 1 - xvf " ${ uhdImagesSrc } " - C " $ o u t "
'' ;
meta = with stdenv . lib ; {
description = " U S R P H a r d w a r e D r i v e r ( f o r S o f t w a r e D e f i n e d R a d i o ) " ;
longDescription = ''
The USRP Hardware Driver ( UHD ) software is the hardware driver for all
USRP ( Universal Software Radio Peripheral ) devices .
USRP devices are designed and sold by Ettus Research , LLC and its parent
company , National Instruments .
'' ;
2017-06-20 03:26:14 +02:00
homepage = https://uhd.ettus.com/ ;
2013-05-02 15:27:11 +02:00
license = licenses . gpl3Plus ;
2017-05-26 05:15:15 +02:00
platforms = platforms . linux ++ platforms . darwin ;
2018-03-29 03:14:08 +02:00
maintainers = with maintainers ; [ bjornfor fpletz tomberek ] ;
2013-05-02 15:27:11 +02:00
} ;
}