fix: make Android SDK env vars conditional on abidir

ANDROID_SDK_ROOT, ANDROID_NDK_HOME, and androidManifest are only
needed for Android builds (when abidir is set). Making them
unconditional causes evaluation failures on aarch64-darwin since
the Android SDK overlay doesn't support that platform.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Prem Chaitanya Prathi 2026-02-09 12:18:01 +05:30
parent 352db9c6a8
commit 53957a1eb3
No known key found for this signature in database

View File

@ -45,9 +45,6 @@ in stdenv.mkDerivation {
pkgs.darwin.cctools gcc # Necessary for libbacktrace
];
# Environment variables required for Android builds
ANDROID_SDK_ROOT="${pkgs.androidPkgs.sdk}";
ANDROID_NDK_HOME="${pkgs.androidPkgs.ndk}";
NIMFLAGS = "-d:disableMarchNative -d:git_revision_override=${revision}";
XDG_CACHE_HOME = "/tmp";
@ -61,6 +58,15 @@ in stdenv.mkDerivation {
configurePhase = ''
patchShebangs . vendor/nimbus-build-system > /dev/null
# build_nim.sh guards "rm -rf dist/checksums" with NIX_BUILD_TOP != "/build",
# but on macOS the nix sandbox uses /private/tmp/... so the check fails and
# dist/checksums (provided via preBuild) gets deleted. Fix the check to skip
# the removal whenever NIX_BUILD_TOP is set (i.e. any nix build).
substituteInPlace vendor/nimbus-build-system/scripts/build_nim.sh \
--replace 'if [[ "''${NIX_BUILD_TOP}" != "/build" ]]; then' \
'if [[ -z "''${NIX_BUILD_TOP}" ]]; then'
make nimbus-build-system-paths
make nimbus-build-system-nimble-dir
'';
@ -104,4 +110,7 @@ in stdenv.mkDerivation {
license = licenses.mit;
platforms = stableSystems;
};
}
} // lib.optionalAttrs (abidir != null) {
ANDROID_SDK_ROOT = "${pkgs.androidPkgs.sdk}";
ANDROID_NDK_HOME = "${pkgs.androidPkgs.ndk}";
})