Skip to content

chore: add Nix devshell for aarch64-linux-android cross-compilation#388

Draft
agentotto[bot] wants to merge 2 commits into
mainfrom
nix/android-devshell
Draft

chore: add Nix devshell for aarch64-linux-android cross-compilation#388
agentotto[bot] wants to merge 2 commits into
mainfrom
nix/android-devshell

Conversation

@agentotto
Copy link
Copy Markdown
Contributor

@agentotto agentotto Bot commented May 1, 2026

Summary

Adds a minimal Nix flake for WalletKit development and Android libwalletkit.so builds without Docker or cross-rs.

The flake provides:

  • default dev shell: pinned Rust toolchain, curl, and git for host development
  • android dev shell: full Android cross-compilation environment for aarch64-linux-android
  • Shells for x86_64-linux, aarch64-darwin, and x86_64-darwin
  • Rust from rust-toolchain.toml via oxalica/rust-overlay
  • Android NDK r27 (27.2.12479018) via androidenv.composeAndroidPackages
  • Platform-specific NDK toolchain paths:
    • Linux: toolchains/llvm/prebuilt/linux-x86_64/bin
    • macOS: toolchains/llvm/prebuilt/darwin-x86_64/bin
  • curl for walletkit-db/build.rs SQLite3MC downloads
  • Android cross-compiler/linker env vars for aarch64-linux-android
  • 16KB page-size Rust linker flags matching .cargo/config.toml

No existing CI workflows or Cross.toml are modified.

Usage

For a pinned Rust host-development environment:

nix develop

For Android cross-compilation:

nix develop .#android

Then build the mobile release artifact:

cargo build -p walletkit --release --target aarch64-linux-android --features compress-zkeys,v3

Or use the helper:

./nix/build-android.sh

Verification

In the workspace I verified:

nix flake check --all-systems --no-build --no-write-lock-file

The shell evaluates for all configured systems.

I could not complete a real nix develop .#android --command cargo build ... in this workspace because the provided pod is aarch64-linux, while this flake intentionally provides the requested x86_64-linux and Darwin shells. Attempting to realize the x86_64 shell on the aarch64 pod fails with Exec format error while running x86_64 Nix builders. This should be validated on an amd64 Linux runner or a supported macOS machine.

Next steps

  • Validate the full Android build on an amd64 Linux or macOS machine/runner.
  • Add additional Android targets once the aarch64 flow is proven.
  • Wire this shell into CI as a follow-up, replacing the Android cross-rs path incrementally.

@agentotto agentotto Bot force-pushed the nix/android-devshell branch 4 times, most recently from ff09ade to b114854 Compare May 1, 2026 15:41
@Dzejkop Dzejkop force-pushed the nix/android-devshell branch from a98431b to 3726bd0 Compare May 3, 2026 23:44
@Dzejkop Dzejkop force-pushed the nix/android-devshell branch from 3726bd0 to dea5100 Compare May 4, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant