From d6fa3fef68b1081c65ebb642b4dfa56d1c1162db Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 21 Oct 2021 23:59:37 +0300 Subject: 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. --- pkgs/applications/radio/gnuradio/shared.nix | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'pkgs/applications/radio/gnuradio/shared.nix') 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 -- cgit 1.4.1