summary refs log tree commit diff
path: root/pkgs/applications/radio/gnuradio
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2021-10-21 23:59:37 +0300
committerDoron Behar <doron.behar@gmail.com>2021-10-23 23:01:21 +0300
commitd6fa3fef68b1081c65ebb642b4dfa56d1c1162db (patch)
treeb412ba2e378db8dcaf5f354aff887ae6c16e9299 /pkgs/applications/radio/gnuradio
parent18eb4531cd291303e6ade31f07a4e72a8cadcc82 (diff)
downloadnixpkgs-d6fa3fef68b1081c65ebb642b4dfa56d1c1162db.tar
nixpkgs-d6fa3fef68b1081c65ebb642b4dfa56d1c1162db.tar.gz
nixpkgs-d6fa3fef68b1081c65ebb642b4dfa56d1c1162db.tar.bz2
nixpkgs-d6fa3fef68b1081c65ebb642b4dfa56d1c1162db.tar.lz
nixpkgs-d6fa3fef68b1081c65ebb642b4dfa56d1c1162db.tar.xz
nixpkgs-d6fa3fef68b1081c65ebb642b4dfa56d1c1162db.tar.zst
nixpkgs-d6fa3fef68b1081c65ebb642b4dfa56d1c1162db.zip
gnuradio: Make hasFeature function simpler
It always needs the `features` attribute of it's derivation as a last
argument, so let's make it do it by it's own.
Diffstat (limited to 'pkgs/applications/radio/gnuradio')
-rw-r--r--pkgs/applications/radio/gnuradio/3.7.nix12
-rw-r--r--pkgs/applications/radio/gnuradio/3.8.nix12
-rw-r--r--pkgs/applications/radio/gnuradio/default.nix8
-rw-r--r--pkgs/applications/radio/gnuradio/shared.nix22
-rw-r--r--pkgs/applications/radio/gnuradio/wrapper.nix10
5 files changed, 32 insertions, 32 deletions
diff --git a/pkgs/applications/radio/gnuradio/3.7.nix b/pkgs/applications/radio/gnuradio/3.7.nix
index 3e423e025b7..40fef6d49fb 100644
--- a/pkgs/applications/radio/gnuradio/3.7.nix
+++ b/pkgs/applications/radio/gnuradio/3.7.nix
@@ -238,34 +238,34 @@ stdenv.mkDerivation rec {
   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) {
+  } // lib.optionalAttrs (hasFeature "gr-uhd") {
     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
     # ./default.nix).
-    ++ lib.optionals (hasFeature "gr-vocoder" features) [
+    ++ lib.optionals (hasFeature "gr-vocoder") [
       "-DLIBCODEC2_LIBRARIES=${codec2}/lib/libcodec2.so"
       "-DLIBCODEC2_INCLUDE_DIR=${codec2}/include"
       "-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm.so"
       "-DLIBGSM_INCLUDE_DIR=${gsm}/include/gsm"
     ]
-    ++ lib.optionals (hasFeature "volk" features && volk != null) [
+    ++ lib.optionals (hasFeature "volk" && volk != null) [
       "-DENABLE_INTERNAL_VOLK=OFF"
     ]
   ;
   stripDebugList = shared.stripDebugList
     # gr-fcd feature was dropped in 3.8
-    ++ lib.optionals (hasFeature "gr-fcd" features) [ "share/gnuradio/examples/fcd" ]
+    ++ lib.optionals (hasFeature "gr-fcd") [ "share/gnuradio/examples/fcd" ]
   ;
   preConfigure = ""
     # wxgui and pygtk are not looked up properly, so we force them to be
     # detected as found, if they are requested by the `features` attrset.
-    + lib.optionalString (hasFeature "gr-wxgui" features) ''
+    + lib.optionalString (hasFeature "gr-wxgui") ''
       sed -i 's/.*wx\.version.*/set(WX_FOUND TRUE)/g' gr-wxgui/CMakeLists.txt
     ''
-    + lib.optionalString (hasFeature "gnuradio-companion" features) ''
+    + lib.optionalString (hasFeature "gnuradio-companion") ''
       sed -i 's/.*pygtk_version.*/set(PYGTK_FOUND TRUE)/g' grc/CMakeLists.txt
     ''
   ;
diff --git a/pkgs/applications/radio/gnuradio/3.8.nix b/pkgs/applications/radio/gnuradio/3.8.nix
index 268a27ab39c..a213d3b86b1 100644
--- a/pkgs/applications/radio/gnuradio/3.8.nix
+++ b/pkgs/applications/radio/gnuradio/3.8.nix
@@ -65,7 +65,7 @@ let
       ]
         # when gr-qtgui is disabled, icu needs to be included, otherwise
         # building with boost 1.7x fails
-        ++ lib.optionals (!(hasFeature "gr-qtgui" features)) [ icu ];
+        ++ lib.optionals (!(hasFeature "gr-qtgui")) [ icu ];
       pythonNative = with python.pkgs; [
         Mako
         six
@@ -233,9 +233,9 @@ stdenv.mkDerivation rec {
   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) {
+  } // lib.optionalAttrs (hasFeature "gr-uhd") {
     inherit uhd;
-  } // lib.optionalAttrs (hasFeature "gr-qtgui" features) {
+  } // lib.optionalAttrs (hasFeature "gr-qtgui") {
     inherit (libsForQt5) qwt;
   };
   cmakeFlags = shared.cmakeFlags
@@ -246,7 +246,7 @@ stdenv.mkDerivation rec {
     #
     # NOTE: qradiolink needs libcodec2 to be detected in
     # order to build, see https://github.com/qradiolink/qradiolink/issues/67
-    ++ lib.optionals (hasFeature "gr-vocoder" features) [
+    ++ lib.optionals (hasFeature "gr-vocoder") [
       "-DLIBCODEC2_FOUND=TRUE"
       "-DLIBCODEC2_LIBRARIES=${codec2}/lib/libcodec2.so"
       "-DLIBCODEC2_INCLUDE_DIRS=${codec2}/include"
@@ -255,7 +255,7 @@ stdenv.mkDerivation rec {
       "-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm.so"
       "-DLIBGSM_INCLUDE_DIRS=${gsm}/include/gsm"
     ]
-    ++ lib.optionals (hasFeature "volk" features && volk != null) [
+    ++ lib.optionals (hasFeature "volk" && volk != null) [
       "-DENABLE_INTERNAL_VOLK=OFF"
     ]
   ;
@@ -263,7 +263,7 @@ stdenv.mkDerivation rec {
   postInstall = shared.postInstall
     # This is the only python reference worth removing, if needed (3.7 doesn't
     # set that reference).
-    + lib.optionalString (!hasFeature "python-support" features) ''
+    + lib.optionalString (!hasFeature "python-support") ''
       ${removeReferencesTo}/bin/remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake
     ''
   ;
diff --git a/pkgs/applications/radio/gnuradio/default.nix b/pkgs/applications/radio/gnuradio/default.nix
index 033d9f6c478..6b81d358ce7 100644
--- a/pkgs/applications/radio/gnuradio/default.nix
+++ b/pkgs/applications/radio/gnuradio/default.nix
@@ -69,7 +69,7 @@ let
       ]
         # when gr-qtgui is disabled, icu needs to be included, otherwise
         # building with boost 1.7x fails
-        ++ lib.optionals (!(hasFeature "gr-qtgui" features)) [ icu ];
+        ++ lib.optionals (!(hasFeature "gr-qtgui")) [ icu ];
       pythonNative = with python.pkgs; [
         Mako
         six
@@ -257,15 +257,15 @@ stdenv.mkDerivation rec {
   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) {
+  } // lib.optionalAttrs (hasFeature "gr-uhd") {
     inherit uhd;
-  } // lib.optionalAttrs (hasFeature "gr-qtgui" features) {
+  } // lib.optionalAttrs (hasFeature "gr-qtgui") {
     inherit (libsForQt5) qwt;
   };
 
   postInstall = shared.postInstall
     # This is the only python reference worth removing, if needed.
-    + lib.optionalString (!hasFeature "python-support" features) ''
+    + lib.optionalString (!hasFeature "python-support") ''
       ${removeReferencesTo}/bin/remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake
       ${removeReferencesTo}/bin/remove-references-to -t ${python} $(readlink -f $out/lib/libgnuradio-runtime.so)
       ${removeReferencesTo}/bin/remove-references-to -t ${python.pkgs.pybind11} $out/lib/cmake/gnuradio/gnuradio-runtimeTargets.cmake
diff --git a/pkgs/applications/radio/gnuradio/shared.nix b/pkgs/applications/radio/gnuradio/shared.nix
index f8ea2f0b160..b38bc90d3cc 100644
--- a/pkgs/applications/radio/gnuradio/shared.nix
+++ b/pkgs/applications/radio/gnuradio/shared.nix
@@ -31,7 +31,7 @@ rec {
   ;
   # Check if a feature is enabled, while defaulting to true if feat is not
   # specified.
-  hasFeature = feat: features: (
+  hasFeature = feat: (
     if builtins.hasAttr feat features then
       features.${feat}
     else
@@ -39,7 +39,7 @@ rec {
   );
   nativeBuildInputs = lib.flatten (lib.mapAttrsToList (
     feat: info: (
-      if hasFeature feat features then
+      if hasFeature feat then
         (if builtins.hasAttr "native" info then info.native else []) ++
         (if builtins.hasAttr "pythonNative" info then info.pythonNative else [])
       else
@@ -48,7 +48,7 @@ rec {
   ) featuresInfo);
   buildInputs = lib.flatten (lib.mapAttrsToList (
     feat: info: (
-      if hasFeature feat features then
+      if hasFeature feat then
         (if builtins.hasAttr "runtime" info then info.runtime else []) ++
         (if builtins.hasAttr "pythonRuntime" info then info.pythonRuntime else [])
       else
@@ -63,7 +63,7 @@ rec {
         # satisfied, let only our cmakeFlags decide.
         "-DENABLE_DEFAULT=OFF"
       else
-        if hasFeature feat features then
+        if hasFeature feat then
           "-DENABLE_${info.cmakeEnableFlag}=ON"
         else
           "-DENABLE_${info.cmakeEnableFlag}=OFF"
@@ -75,17 +75,17 @@ rec {
     stdenv.cc.cc
   ]
     # If python-support is disabled, we probably don't want it referenced
-    ++ lib.optionals (!hasFeature "python-support" features) [ python ]
+    ++ lib.optionals (!hasFeature "python-support") [ python ]
   ;
   # Gcc references from examples
   stripDebugList = [ "lib" "bin" ]
-    ++ lib.optionals (hasFeature "gr-audio" features) [ "share/gnuradio/examples/audio" ]
-    ++ lib.optionals (hasFeature "gr-uhd" features) [ "share/gnuradio/examples/uhd" ]
-    ++ lib.optionals (hasFeature "gr-qtgui" features) [ "share/gnuradio/examples/qt-gui" ]
+    ++ lib.optionals (hasFeature "gr-audio") [ "share/gnuradio/examples/audio" ]
+    ++ lib.optionals (hasFeature "gr-uhd") [ "share/gnuradio/examples/uhd" ]
+    ++ lib.optionals (hasFeature "gr-qtgui") [ "share/gnuradio/examples/qt-gui" ]
   ;
   postInstall = ""
     # Gcc references
-    + lib.optionalString (hasFeature "gnuradio-runtime" features) ''
+    + lib.optionalString (hasFeature "gnuradio-runtime") ''
       ${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc} $(readlink -f $out/lib/libgnuradio-runtime.so)
     ''
   ;
@@ -101,9 +101,9 @@ rec {
       featuresInfo
       python
     ;
-  } // lib.optionalAttrs (hasFeature "gr-qtgui" features) {
+  } // lib.optionalAttrs (hasFeature "gr-qtgui") {
     inherit qt;
-  } // lib.optionalAttrs (hasFeature "gnuradio-companion" features) {
+  } // lib.optionalAttrs (hasFeature "gnuradio-companion") {
     inherit gtk;
   };
   # Wrapping is done with an external wrapper
diff --git a/pkgs/applications/radio/gnuradio/wrapper.nix b/pkgs/applications/radio/gnuradio/wrapper.nix
index 58205f388f2..4cbccbd5181 100644
--- a/pkgs/applications/radio/gnuradio/wrapper.nix
+++ b/pkgs/applications/radio/gnuradio/wrapper.nix
@@ -41,7 +41,7 @@ let
     ++ (builtins.map unwrapped.python.pkgs.toPythonModule extraPackages)
     ++ lib.flatten (lib.mapAttrsToList (
       feat: info: (
-        if unwrapped.hasFeature feat unwrapped.features then
+        if unwrapped.hasFeature feat then
           (if builtins.hasAttr "pythonRuntime" info then info.pythonRuntime else [])
         else
           []
@@ -55,8 +55,8 @@ let
   ]
     # Emulating wrapGAppsHook & wrapQtAppsHook working together
     ++ lib.optionals (
-      (unwrapped.hasFeature "gnuradio-companion" unwrapped.features)
-      || (unwrapped.hasFeature "gr-qtgui" unwrapped.features)
+      (unwrapped.hasFeature "gnuradio-companion")
+      || (unwrapped.hasFeature "gr-qtgui")
       ) [
       "--prefix" "XDG_DATA_DIRS" ":" "$out/share"
       "--prefix" "XDG_DATA_DIRS" ":" "$out/share/gsettings-schemas/${name}"
@@ -66,7 +66,7 @@ let
       # https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1764890.html
       "--prefix" "PATH" ":" "${lib.getBin glib}/bin"
     ]
-    ++ lib.optionals (unwrapped.hasFeature "gnuradio-companion" unwrapped.features) [
+    ++ lib.optionals (unwrapped.hasFeature "gnuradio-companion") [
       "--set" "GDK_PIXBUF_MODULE_FILE" "${librsvg}/${gdk-pixbuf.moduleDir}.cache"
       "--prefix" "GIO_EXTRA_MODULES" ":" "${lib.getLib dconf}/lib/gio/modules"
       "--prefix" "XDG_DATA_DIRS" ":" "${unwrapped.gtk}/share"
@@ -89,7 +89,7 @@ let
     ++ lib.optionals (extraPackages != []) [
       "--prefix" "GRC_BLOCKS_PATH" ":" "${lib.makeSearchPath "share/gnuradio/grc/blocks" extraPackages}"
     ]
-    ++ lib.optionals (unwrapped.hasFeature "gr-qtgui" unwrapped.features)
+    ++ lib.optionals (unwrapped.hasFeature "gr-qtgui")
       # 3.7 builds with qt4
       (if lib.versionAtLeast unwrapped.versionAttr.major "3.8" then
         [