diff options
author | Doron Behar <doron.behar@gmail.com> | 2021-10-21 23:59:37 +0300 |
---|---|---|
committer | Doron Behar <doron.behar@gmail.com> | 2021-10-23 23:01:21 +0300 |
commit | d6fa3fef68b1081c65ebb642b4dfa56d1c1162db (patch) | |
tree | b412ba2e378db8dcaf5f354aff887ae6c16e9299 /pkgs/applications/radio/gnuradio/shared.nix | |
parent | 18eb4531cd291303e6ade31f07a4e72a8cadcc82 (diff) | |
download | nixpkgs-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/shared.nix')
-rw-r--r-- | pkgs/applications/radio/gnuradio/shared.nix | 22 |
1 files changed, 11 insertions, 11 deletions
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 |