2 description = "Dev environment for opencode-android — a Crux (Rust) core + Kotlin / Jetpack Compose shell";
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 flake-utils.url = "github:numtide/flake-utils";
9 outputs = { self, nixpkgs, flake-utils }:
10 flake-utils.lib.eachDefaultSystem (system:
12 # Kept in sync with the Gradle project (see gradle/libs.versions.toml and
13 # app/build.gradle.kts). These are the versions actually provisioned below,
14 # so `compileSdk` / `buildToolsVersion` must match or Gradle will try to
15 # download SDK components at build time.
16 platformVersion = "35";
17 buildToolsVersion = "35.0.0";
19 pkgs = import nixpkgs {
22 allowUnfree = true; # the Android SDK is unfree
23 android_sdk.accept_license = true;
27 android = pkgs.androidenv.composeAndroidPackages {
28 platformVersions = [ platformVersion ];
29 buildToolsVersions = [ buildToolsVersion ];
30 cmdLineToolsVersion = "latest";
32 includeEmulator = false;
33 includeSystemImages = false;
35 # The Rust core is NOT cross-compiled to a JNI .so in this setup: nixpkgs'
36 # `rustc` ships no Android std and no NDK is provisioned. The core is built
37 # and unit-tested natively (`cargo test`), and the Android shell runs a
38 # faithful Kotlin port of the reducer. Flip `includeNDK = true` and add
39 # `cargo-ndk` below to build the real .so once a cross-toolchain is present.
43 sdk = android.androidsdk;
44 sdkRoot = "${sdk}/libexec/android-sdk";
45 aapt2Path = "${sdkRoot}/build-tools/${buildToolsVersion}/aapt2";
47 devShells.default = pkgs.mkShell {
49 # JVM / Android toolchain
54 # Rust toolchain for the Crux core (build, test, typegen codegen)
59 ANDROID_HOME = sdkRoot;
60 ANDROID_SDK_ROOT = sdkRoot;
61 JAVA_HOME = "${pkgs.jdk17}";
63 # AGP resolves aapt2 from a Maven artifact by default; point it at the
64 # SDK-provided binary so the build works fully offline / hermetically.
65 GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${aapt2Path}";
68 echo "opencode-android dev shell"
69 echo " JDK: $(java -version 2>&1 | head -1)"
70 echo " Rust: $(rustc --version)"
71 echo " Gradle: $(gradle --version 2>/dev/null | awk '/^Gradle/{print $2}')"
72 echo " ANDROID_HOME: $ANDROID_HOME"
74 echo " Core: (cd shared && cargo test) # Crux core unit tests"
75 echo " Types: (cd shared && cargo run --bin codegen)"
76 echo " App: ./gradlew assembleDebug # build debug APK"
77 echo " Unit: ./gradlew testDebugUnitTest"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list