From 2557230bf62d87b753ffe3fb96c2b434843caac3 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 21 Sep 2023 00:30:00 +0300 Subject: [PATCH] androidndkPkgs: throw if targetPackages is not populated It's better to exit with a throw than a attribute missing which cannot be caught with tryEval ``` > pkgsCross.aarch64-android-prebuilt.androidndkPkgs error: attribute 'androidndkPkgs_21' missing ``` Proper ways to to use `androidndkPkgs` AFAIK. `with import ./. { crossSystem = (import ./lib).systems.examples.aarch64-android-prebuilt; }; buildPackages.androidndkPkgs` or `pkgsCross.aarch64-android-prebuilt.buildPackages.androidndkPkgs` --- pkgs/development/androidndk-pkgs/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/androidndk-pkgs/default.nix b/pkgs/development/androidndk-pkgs/default.nix index a7001ce1d4a6..8aa7eefe4215 100644 --- a/pkgs/development/androidndk-pkgs/default.nix +++ b/pkgs/development/androidndk-pkgs/default.nix @@ -29,7 +29,7 @@ # these two really are the same. buildAndroidndk = buildAndroidComposition.ndk-bundle; androidndk = androidComposition.ndk-bundle; - targetAndroidndkPkgs = targetPackages.androidndkPkgs_21; + targetAndroidndkPkgs = if targetPackages ? androidndkPkgs_21 then targetPackages.androidndkPkgs_21 else throw "androidndkPkgs_21: no targetPackages, use `buildPackages.androidndkPkgs_21"; }; "23b" = @@ -59,7 +59,7 @@ # these two really are the same. buildAndroidndk = buildAndroidComposition.ndk-bundle; androidndk = androidComposition.ndk-bundle; - targetAndroidndkPkgs = targetPackages.androidndkPkgs_23b; + targetAndroidndkPkgs = if targetPackages ? androidndkPkgs_23b then targetPackages.androidndkPkgs_23b else throw "androidndkPkgs_23b: no targetPackages, use `buildPackages.androidndkPkgs_23b"; }; "24" = @@ -89,7 +89,7 @@ # these two really are the same. buildAndroidndk = buildAndroidComposition.ndk-bundle; androidndk = androidComposition.ndk-bundle; - targetAndroidndkPkgs = targetPackages.androidndkPkgs_24; + targetAndroidndkPkgs = if targetPackages ? androidndkPkgs_24 then targetPackages.androidndkPkgs_24 else throw "androidndkPkgs_24: no targetPackages, use `buildPackages.androidndkPkgs_24"; }; }