diff options
author | Felix Buehler <account@buehler.rocks> | 2023-02-14 19:11:59 +0100 |
---|---|---|
committer | Felix Buehler <account@buehler.rocks> | 2023-02-14 19:11:59 +0100 |
commit | bc3d5934d7f276a21537b40159491257ee163d94 (patch) | |
tree | 53b1d9bd9cb148a0ab34f2fd9e1d94802dde639e /pkgs/applications/radio/gnuradio | |
parent | 3bee4ab8db244db328b41ae5f4fbce19b658f1be (diff) |
treewide: use lib.optionals
Diffstat (limited to 'pkgs/applications/radio/gnuradio')
-rw-r--r-- | pkgs/applications/radio/gnuradio/shared.nix | 18 | ||||
-rw-r--r-- | pkgs/applications/radio/gnuradio/wrapper.nix | 7 |
2 files changed, 10 insertions, 15 deletions
diff --git a/pkgs/applications/radio/gnuradio/shared.nix b/pkgs/applications/radio/gnuradio/shared.nix index ff6aaf35bea09..bdbc22cb787d3 100644 --- a/pkgs/applications/radio/gnuradio/shared.nix +++ b/pkgs/applications/radio/gnuradio/shared.nix @@ -37,20 +37,18 @@ rec { ); nativeBuildInputs = lib.flatten (lib.mapAttrsToList ( feat: info: ( - if hasFeature feat then - (if builtins.hasAttr "native" info then info.native else []) ++ - (if builtins.hasAttr "pythonNative" info then info.pythonNative else []) - else - [] + lib.optionals (hasFeature feat) ( + (lib.optionals (builtins.hasAttr "native" info) info.native) ++ + (lib.optionals (builtins.hasAttr "pythonNative" info) info.pythonNative) + ) ) ) featuresInfo); buildInputs = lib.flatten (lib.mapAttrsToList ( feat: info: ( - if hasFeature feat then - (if builtins.hasAttr "runtime" info then info.runtime else []) ++ - (if builtins.hasAttr "pythonRuntime" info then info.pythonRuntime else []) - else - [] + lib.optionals (hasFeature feat) ( + (lib.optionals (builtins.hasAttr "runtime" info) info.runtime) ++ + (lib.optionals (builtins.hasAttr "pythonRuntime" info) info.pythonRuntime) + ) ) ) featuresInfo); cmakeFlags = lib.mapAttrsToList ( diff --git a/pkgs/applications/radio/gnuradio/wrapper.nix b/pkgs/applications/radio/gnuradio/wrapper.nix index 926022353e41f..c38c89fc459b1 100644 --- a/pkgs/applications/radio/gnuradio/wrapper.nix +++ b/pkgs/applications/radio/gnuradio/wrapper.nix @@ -41,12 +41,9 @@ let ++ (builtins.map unwrapped.python.pkgs.toPythonModule extraPackages) ++ lib.flatten (lib.mapAttrsToList ( feat: info: ( - if unwrapped.hasFeature feat then - (if builtins.hasAttr "pythonRuntime" info then info.pythonRuntime else []) - else - [] + lib.optionals ((unwrapped.hasFeature feat) && (builtins.hasAttr "pythonRuntime" info)) info.pythonRuntime ) - ) unwrapped.featuresInfo) + ) unwrapped.featuresInfo) ; pythonEnv = unwrapped.python.withPackages(ps: pythonPkgs); |