Skip to content

feat(android): Move flake to devbox.d and add android.lock#18

Draft
abueide wants to merge 2 commits intomainfrom
feat/android-flake-and-lock
Draft

feat(android): Move flake to devbox.d and add android.lock#18
abueide wants to merge 2 commits intomainfrom
feat/android-flake-and-lock

Conversation

@abueide
Copy link
Copy Markdown
Contributor

@abueide abueide commented Apr 21, 2026

Summary

Part 1 of 6 from split of #17 (~312 lines).

Implements core feature: moves flake to version-controlled location and adds android.lock for reproducibility.

Key Changes

  • Flake location: Moved to devbox.d/ for version control
  • android.lock: New lock file pins SDK configuration
  • Unified sync: Foundation for android:sync command

Related PRs

Part of 6-PR split of #17:

All PRs are independent and can be reviewed in parallel.

abueide and others added 2 commits April 21, 2026 13:18
Moves the Android SDK flake.nix from the ephemeral .devbox/virtenv
directory to devbox.d/<plugin-name>/ so the flake and its lock file
can be committed and version controlled per-project.

**Changes:**
- Copy flake.nix to `{{ .DevboxDir }}` instead of `{{ .Virtenv }}`
- Update core.sh to look for flake in ANDROID_CONFIG_DIR first
- Update README to clarify flake.lock location and purpose
- Add react-native example devbox.d configs to demonstrate structure

**Benefits:**
- Projects can version control their flake.lock for reproducible builds
- Each project can have different Android SDK versions/configurations
- Lock file updates via `devbox run devices.sh sync` or `nix flake update`
- Consistent with where device configs live (devbox.d/)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements a two-stage configuration model for reproducible Android builds:
- **Stage 1**: Edit env vars in devbox.json (easy to change)
- **Stage 2**: Run `android:sync` to generate lock files (commit to git)

**Changes:**

1. **android.lock file** - Pins Android SDK configuration
   - Generated from env vars by `android:sync` command
   - Committed to git for team-wide reproducibility
   - Makes SDK changes reviewable in PRs

2. **Unified sync command** - `devbox run android:sync`
   - Generates android.lock from env vars
   - Regenerates devices.lock from device JSONs
   - Syncs AVDs to match device definitions
   - One command to sync all configuration

3. **Drift detection** - Warns on shell init if config is out of sync
   - Compares env vars with android.lock
   - Shows which values don't match
   - Provides clear instructions to fix

4. **Comprehensive documentation**
   - Explains env var → lock file model
   - Step-by-step update guide
   - Separates Android SDK updates from nixpkgs updates
   - Clarifies why reproducibility matters

**Benefits:**
- Reproducible: Lock files ensure identical builds across team
- Reviewable: SDK changes visible in PRs
- Explicit: Must run sync to apply changes (no accidents)
- Detectable: Warns if env vars drift from lock file

**Example workflow:**
```sh
devbox run android:sync
git add devbox.json devbox.d/ && git commit
```

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@abueide abueide force-pushed the feat/android-flake-and-lock branch from efd31fa to f60ad6a Compare April 21, 2026 18:18
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