Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
96e7bb5
chore: add Nix Android devshell
Dzejkop May 4, 2026
3c6e2c1
wasm build support
Dzejkop May 4, 2026
c6b77f2
nix based kotlin workflow
Dzejkop Jun 24, 2026
3b0d169
temp trigger
Dzejkop Jun 24, 2026
52fb060
fix?
Dzejkop Jun 24, 2026
d949930
try cachix instead
Dzejkop Jun 24, 2026
ebf98c3
no root
Dzejkop Jun 24, 2026
09e6c44
fix
Dzejkop Jun 24, 2026
ea3a82b
rust cache
Dzejkop Jun 24, 2026
69c4986
remove comment
Dzejkop Jun 24, 2026
a47b58e
swift support with nix
Dzejkop Jun 24, 2026
b3af4d0
test: swift workflow
Dzejkop Jun 24, 2026
359f251
chore(nix): build android with embed-zkeys to match release; document…
Dzejkop Jul 9, 2026
ec92d72
ci: add magic-nix-cache fragility TODOs, pin macOS image and Xcode fo…
Dzejkop Jul 9, 2026
d411f31
ci: align cargo cache keys across nix workflows
Dzejkop Jul 9, 2026
552a842
feat(nix): package nargo from official release binaries, add to all d…
Dzejkop Jul 9, 2026
c1ef208
ci: pin GitHub actions by commit hash
Dzejkop Jul 9, 2026
efc2d00
fix(nix): drop duplicated android rustflags, defer to .cargo/config.toml
Dzejkop Jul 9, 2026
6a83adc
chore: pass --locked to all CI/release cargo invocations
Dzejkop Jul 9, 2026
e70d92e
chore(nix): add license/platforms/provenance metadata to nargo, expli…
Dzejkop Jul 9, 2026
8d6d410
fix(nix): make swift Xcode pin fail loudly instead of drifting
Dzejkop Jul 9, 2026
fee9fbc
ci: build release artifacts via nix, drop cross and rustup action
Dzejkop Jul 9, 2026
c652662
feat(nix): support aarch64-linux (for docker on ARM hosts), gate andr…
Dzejkop Jul 9, 2026
3e88b9d
docs(nix): add docker wrapper for hosts without nix + devshell docs
Dzejkop Jul 9, 2026
6967185
chore(kotlin): migrate local build scripts from cross to nix shell
Dzejkop Jul 9, 2026
1819763
refactor(ci): reuse build scripts in kotlin workflows
Dzejkop Jul 9, 2026
153724d
Apply suggestions from code review
Dzejkop Jul 9, 2026
5f82405
docs(nix): document bare-metal iOS build requirements
Dzejkop Jul 9, 2026
40061bd
docs(swift): explain what the nix shell provides vs bare builds
Dzejkop Jul 9, 2026
61e8667
ci: consolidate Nix release workflows
Dzejkop Jul 10, 2026
8d77088
refactor(nix): make Docker wrapper proxy Nix CLI
Dzejkop Jul 10, 2026
a6d4f8f
ci: temporarily test Nix native release builds
Dzejkop Jul 10, 2026
5b4961d
refactor(swift): keep release build on host toolchain
Dzejkop Jul 10, 2026
f5bfdb4
refactor(kotlin): require caller-provided build environment
Dzejkop Jul 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 41 additions & 46 deletions .github/workflows/release-swift-kotlin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Get new version
id: version
Expand All @@ -29,14 +29,16 @@ jobs:
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT

build-swift:
# Swift depends on the host macOS/Xcode configuration and intentionally does
# not run inside Nix.
runs-on: macos-latest
needs: pre-release-checks
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ needs.pre-release-checks.outputs.commit_sha }} # to ensure all builds are consistent

Expand All @@ -57,14 +59,14 @@ jobs:
zip -r WalletKit.xcframework.zip swift/WalletKit.xcframework

- name: Checkout swift repo
uses: actions/checkout@v6
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
repository: worldcoin/walletkit-swift
token: ${{ secrets.WALLETKIT_BOT_TOKEN }}
path: target-repo

- name: Create draft release in walletkit-swift & upload binaries
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
id: release
with:
repository: worldcoin/walletkit-swift
Expand Down Expand Up @@ -126,11 +128,9 @@ jobs:
name: Prepare Kotlin
runs-on: arc-public-8xlarge-amd64-runner
needs: [pre-release-checks]
env:
CARGO_HOME: /home/runner/_work/_cargo
RUSTUP_HOME: /home/runner/_work/_rustup
permissions:
contents: write # to upload artifacts
contents: read
actions: write # to save Rust cache

# Each target is built separately to run in parallel. Running sequentially takes vastly more time.
strategy:
Expand All @@ -143,31 +143,36 @@ jobs:
- target: i686-linux-android

steps:
- name: Add Cargo to PATH
run: echo "$CARGO_HOME/bin" >> $GITHUB_PATH

- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ needs.pre-release-checks.outputs.commit_sha }} # to ensure all builds are consistent

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.92.0
targets: ${{ matrix.settings.target }}
components: rustfmt
- name: Install Nix
uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31.10.6

- name: Install Cross
run: |
cargo install cross --git https://github.com/cross-rs/cross --locked
# TODO: magic-nix-cache is best-effort; builds still work without it.
- name: Enable Nix cache
uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13

- name: Cache Rust build artifacts
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.cargo/registry
~/.cargo/git
target/release
target/${{ matrix.settings.target }}
key: ${{ runner.os }}-cargo-android-${{ matrix.settings.target }}-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml', 'flake.lock', 'flake.nix', 'nix/**/*.nix') }}
restore-keys: |
${{ runner.os }}-cargo-android-${{ matrix.settings.target }}-
${{ runner.os }}-cargo-android-

- name: Build for target
run: |
CROSS_NO_WARNINGS=0 cross build -p walletkit --target ${{ matrix.settings.target }} --release --locked --features "$WALLETKIT_CARGO_FEATURES"
run: ./nix/build-android.sh --target ${{ matrix.settings.target }}

- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: android-${{ matrix.settings.target }}
path: ./target/${{ matrix.settings.target }}/release/libwalletkit.so
Expand All @@ -183,40 +188,30 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ needs.pre-release-checks.outputs.commit_sha }} # to ensure all builds are consistent

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.92.0
targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android
components: rustfmt
- name: Install Nix
uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31.10.6

# TODO: magic-nix-cache is best-effort; builds still work without it.
- name: Enable Nix cache
uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@17f84c3641ba7b8f6deff6309fc4c864478f5d62 # v3.14.1
with:
distribution: temurin
java-version: 17

- name: Download Artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: .
path: artifacts

- name: Move artifacts
run: |
mkdir -p kotlin/walletkit/src/main/jniLibs && cd kotlin/walletkit/src/main/jniLibs
mkdir armeabi-v7a arm64-v8a x86 x86_64
mv /home/runner/work/walletkit/walletkit/android-armv7-linux-androideabi/libwalletkit.so ./armeabi-v7a/libwalletkit.so
mv /home/runner/work/walletkit/walletkit/android-aarch64-linux-android/libwalletkit.so ./arm64-v8a/libwalletkit.so
mv /home/runner/work/walletkit/walletkit/android-i686-linux-android/libwalletkit.so ./x86/libwalletkit.so
mv /home/runner/work/walletkit/walletkit/android-x86_64-linux-android/libwalletkit.so ./x86_64/libwalletkit.so

- name: Generate bindings
working-directory: kotlin
run: cargo run -p uniffi-bindgen generate ./walletkit/src/main/jniLibs/arm64-v8a/libwalletkit.so --library --language kotlin --no-format --out-dir walletkit/src/main/java
- name: Assemble jniLibs & generate bindings
run: nix develop . --command ./kotlin/build_kotlin.sh --artifacts-dir artifacts

- name: Publish
working-directory: kotlin
Expand Down
24 changes: 0 additions & 24 deletions Cross.toml

This file was deleted.

14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,9 @@ Replace `VERSION` with the desired WalletKit version.

### Prerequisites

1. **Docker Desktop**: Required for cross-compilation
- The build uses [`cross`](https://github.com/cross-rs/cross) which runs builds in Docker containers with all necessary toolchains
- Install via Homebrew:
```bash
brew install --cask docker
```
- Launch Docker Desktop and ensure it's running before building
1. **Nix**: The Android cross-compilation toolchain (Rust, NDK, linkers) is provided
by the Nix devshell — see [`nix/README.md`](nix/README.md). Without Nix, you
must provision the equivalent dependencies manually.

2. **Android SDK + NDK**: Required for Gradle Android tasks
- Install via Android Studio > Settings > Android SDK (ensure the NDK is installed)
Expand All @@ -57,15 +53,15 @@ Replace `VERSION` with the desired WalletKit version.
To test local changes before publishing a release, use the build script to compile the Rust library, generate UniFFI bindings, and publish a SNAPSHOT to Maven Local:

```bash
./kotlin/local_kotlin.sh 0.3.1
nix develop .#android --command ./kotlin/local_kotlin.sh 0.3.1
```

Example with custom Rust locations:
```bash
RUSTUP_HOME=~/.rustup CARGO_HOME=~/.cargo ./kotlin/local_kotlin.sh 0.1.0-SNAPSHOT
```

> **Note**: The script can be run from any working directory (it resolves its own location). It sets `RUSTUP_HOME` and `CARGO_HOME` to `/tmp` by default to avoid Docker permission issues when using `cross`. You can override them by exporting your own values.
> **Note**: The script resolves its own location, but does not provision or enter the build environment. Run it from the Nix `android` devshell or with the required dependencies configured manually.

This will:
1. Build the Rust library for all Android architectures (arm64-v8a, armeabi-v7a, x86_64, x86)
Expand Down
82 changes: 82 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
description = "WalletKit development shells";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
] (system:
let
overlays = [
(import rust-overlay)
(final: prev: { nargo = final.callPackage ./nix/nargo.nix { }; })
];
pkgs = import nixpkgs {
inherit system overlays;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
};

rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in
{
devShells = {
default = pkgs.mkShell {
packages = [
rustToolchain
pkgs.curl
pkgs.git
pkgs.nargo
];
};

wasm = import ./nix/wasm.nix { inherit pkgs; };
} // pkgs.lib.optionalAttrs (!(pkgs.stdenv.isLinux && pkgs.stdenv.isAarch64)) {
# The Android NDK has no aarch64-linux prebuilt toolchain
# (on aarch64 Docker hosts, run the container as linux/amd64).
android = import ./nix/android.nix { inherit pkgs; };
};
});
}
Loading