From a8060c56006e006b8b0a3eb3d614b9ddfb0f7252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Fri, 24 Oct 2025 11:58:15 +0200 Subject: [PATCH] nix: do not add android SDK on aarch64 Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise it fails with: error: aarch64-darwin not supported for Android SDK. Use: NIXPKGS_SYSTEM_OVERRIDE=x86_64-darwin Signed-off-by: Jakub SokoĊ‚owski --- flake.nix | 7 +++++++ nix/default.nix | 2 -- nix/shell.nix | 17 +++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index a017876..9fe7fb0 100644 --- a/flake.nix +++ b/flake.nix @@ -65,5 +65,12 @@ targets = [ name ]; }; }) targets)); + + devShells = forAllSystems (system: let + pkgs = pkgsFor.${system}; + in { + default = pkgs.callPackage ./nix/shell.nix { } ; + }); }; + } diff --git a/nix/default.nix b/nix/default.nix index 82f8fa2..01dd252 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -88,5 +88,3 @@ in stdenv.mkDerivation rec { platforms = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" "x86_64-windows"]; }; } - - diff --git a/nix/shell.nix b/nix/shell.nix index d21eb01..fe94d89 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -2,21 +2,22 @@ pkgs ? import { }, }: let - optionalDarwinDeps = pkgs.lib.optionals pkgs.stdenv.isDarwin [ - pkgs.libiconv - pkgs.darwin.apple_sdk.frameworks.Security - ]; -in -pkgs.mkShell { - inputsFrom = [ + inherit (pkgs) lib stdenv; + /* No Android SDK for Darwin aarch64. */ + isMacM1 = stdenv.isDarwin && stdenv.isAarch64; + +in pkgs.mkShell { + inputsFrom = lib.optionals (!isMacM1) [ pkgs.androidShell - ] ++ optionalDarwinDeps; + ]; buildInputs = with pkgs; [ which git cmake nim-unwrapped-2_2 + ] ++ lib.optionals stdenv.isDarwin [ + pkgs.libiconv ]; # Avoid compiling Nim itself.