Skip to content

Commit

Permalink
Merge pull request #106599 from doronbehar/pkg/gnuradio/pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
doronbehar authored Mar 13, 2021
2 parents 4f6919d + fb024f5 commit 5e367ec
Show file tree
Hide file tree
Showing 28 changed files with 1,288 additions and 539 deletions.
12 changes: 11 additions & 1 deletion nixos/doc/manual/release-notes/rl-2105.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@
now point to an externally wrapped by default derivations, that allow you to
also add `extraPythonPackages` to the Python interpreter used by GNURadio.
Missing environmental variables needed for operational GUI were also added
(<link xlink:href="https://github.com/NixOS/nixpkgs/issues/75478">#7547</link>).
(<link xlink:href="https://github.com/NixOS/nixpkgs/issues/75478">#75478</link>).
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://www.gnuradio.org/">GNURadio</link> has a
<code>pkgs</code> attribute set, and there's a <code>gnuradio.callPackage</code>
function that extends <code>pkgs</code> with a <code>mkDerivation</code>, and a
<code>mkDerivationWith</code>, like Qt5. Now all <code>gnuradio.pkgs</code> are
defined with <code>gnuradio.callPackage</code> and some packages that depend
on gnuradio are defined with this as well.
</para>
</listitem>
<listitem>
Expand Down
32 changes: 19 additions & 13 deletions pkgs/applications/radio/gnss-sdr/default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{ lib, stdenv, fetchFromGitHub
{ lib
, fetchFromGitHub
, armadillo
, boost
, cmake
, gmp
, glog
, gmock
, openssl
, gflags
, gnuradio
, gnuradio3_8
, libpcap
, orc
, pkg-config
, pythonPackages
, uhd
, log4cpp
, blas, lapack
Expand All @@ -18,7 +19,7 @@
, protobuf
}:

stdenv.mkDerivation rec {
gnuradio3_8.pkgs.mkDerivation rec {
pname = "gnss-sdr";
version = "0.0.13";

Expand All @@ -29,27 +30,32 @@ stdenv.mkDerivation rec {
sha256 = "0a3k47fl5dizzhbqbrbmckl636lznyjby2d2nz6fz21637hvrnby";
};

nativeBuildInputs = [ cmake pkg-config ];
nativeBuildInputs = [
cmake
gnuradio3_8.unwrapped.python
gnuradio3_8.unwrapped.python.pkgs.Mako
gnuradio3_8.unwrapped.python.pkgs.six
];

buildInputs = [
gmp
armadillo
boost.dev
gnuradio3_8.unwrapped.boost
glog
gmock
openssl.dev
openssl
gflags
gnuradio
orc
pythonPackages.Mako
pythonPackages.six

# UHD support is optional, but gnuradio is built with it, so there's
# nothing to be gained by leaving it out.
uhd
gnuradio3_8.unwrapped.uhd
log4cpp
blas lapack
matio
pugixml
protobuf
gnuradio3_8.pkgs.osmosdr
libpcap
];

cmakeFlags = [
Expand Down
55 changes: 22 additions & 33 deletions pkgs/applications/radio/gnuradio/3.7.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Remove gcc and python references
, removeReferencesTo
, pkg-config
, volk
, cppunit
, swig
, orc
Expand Down Expand Up @@ -43,11 +44,12 @@
minor = "14";
patch = "0";
}
, fetchSubmodules ? true
# We use our build of volk and not the one bundled with the release
, fetchSubmodules ? false
}:

let
sourceSha256 = "1nh4f9dmygprlbqybd3j1byg9fsr6065n140mvc4b0v8qqygmhrc";
sourceSha256 = "BiUDibXV/5cEYmAAaIxT4WTxF/ni4MJumF5oJ/vuOyc=";
featuresInfo = {
# Needed always
basic = {
Expand All @@ -61,6 +63,9 @@ let
};
volk = {
cmakeEnableFlag = "VOLK";
runtime = [
volk
];
};
doxygen = {
native = [ doxygen ];
Expand Down Expand Up @@ -213,19 +218,29 @@ let
qt = qt4;
gtk = gtk2;
});
inherit (shared) hasFeature; # function
in

stdenv.mkDerivation rec {
inherit pname;
inherit (shared)
version
src
hasFeature # function
nativeBuildInputs
buildInputs
disallowedReferences
postInstall
passthru
doCheck
dontWrapPythonPrograms
meta
;

passthru = shared.passthru // {
# Deps that are potentially overriden and are used inside GR plugins - the same version must
inherit boost volk;
} // lib.optionalAttrs (hasFeature "gr-uhd" features) {
inherit uhd;
};
cmakeFlags = shared.cmakeFlags
# From some reason, if these are not set, libcodec2 and gsm are
# not detected properly (slightly different then what's in
Expand All @@ -236,6 +251,9 @@ let
"-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm.so"
"-DLIBGSM_INCLUDE_DIR=${gsm}/include/gsm"
]
++ lib.optionals (hasFeature "volk" features && volk != null) [
"-DENABLE_INTERNAL_VOLK=OFF"
]
;
stripDebugList = shared.stripDebugList
# gr-fcd feature was dropped in 3.8
Expand All @@ -250,15 +268,6 @@ let
+ lib.optionalString (hasFeature "gnuradio-companion" features) ''
sed -i 's/.*pygtk_version.*/set(PYGTK_FOUND TRUE)/g' grc/CMakeLists.txt
''
# If python-support is disabled, don't install volk's (git submodule)
# volk_modtool - it references python.
#
# NOTE: The same is done for 3.8, but we don't put this string in
# ./shared.nix since on the next release of 3.8 it won't be needed there,
# but it will be needed for 3.7, probably for ever.
+ lib.optionalString (!hasFeature "python-support" features) ''
sed -i -e "/python\/volk_modtool/d" volk/CMakeLists.txt
''
;
patches = [
# Don't install python referencing files if python support is disabled.
Expand All @@ -272,24 +281,4 @@ let
sha256 = "2Pitgu8accs16B5X5+/q51hr+IY9DMsA15f56gAtBs8=";
})
];
in

stdenv.mkDerivation rec {
inherit
pname
version
src
nativeBuildInputs
buildInputs
cmakeFlags
preConfigure
# disallowedReferences
stripDebugList
patches
postInstall
passthru
doCheck
dontWrapPythonPrograms
meta
;
}
Loading

0 comments on commit 5e367ec

Please sign in to comment.