diff --git a/nix/default.nix b/nix/default.nix index 8366ae0..7b59e79 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -140,7 +140,10 @@ in stdenv.mkDerivation { buildPhase = '' export NIMBLE_DIR="$(pwd)/vendor/.nimble" - + '' + lib.optionalString isAndroidBuild '' + # Add NDK toolchain to PATH so Nim can find clang for Android cross-compilation + export PATH="$(echo $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/*/bin):$PATH" + '' + '' ${lib.concatMapStringsSep "\n" buildCommandForTarget targets} ''; diff --git a/sds.nimble b/sds.nimble index 8a55b2c..cfd1145 100644 --- a/sds.nimble +++ b/sds.nimble @@ -48,8 +48,15 @@ proc getArch(): string = # Tasks task test, "Run the test suite": - exec "nim c -r tests/test_bloom.nim" - exec "nim c -r tests/test_reliability.nim" + var extraFlags = "" + when defined(macosx): + let arch = getArch() + if arch == "arm64": + extraFlags = "--cpu:arm64 " + else: + extraFlags = "--cpu:amd64 " + exec "nim c -r " & extraFlags & "tests/test_bloom.nim" + exec "nim c -r " & extraFlags & "tests/test_reliability.nim" task libsdsDynamicWindows, "Generate bindings": let outLibNameAndExt = "libsds.dll"