Nix flake for building GNU Emacs for Android with optional Nix package manager integration.
- Nix 67.1%
- Just 22.3%
- Emacs Lisp 10.6%
| .config | ||
| keys | ||
| lib | ||
| packages | ||
| templates | ||
| .copier-answers.yml | ||
| .editorconfig | ||
| .envrc | ||
| .gitignore | ||
| .ignore | ||
| biome.json | ||
| CLAUDE.md | ||
| cog.toml | ||
| flake.lock | ||
| flake.nix | ||
| Justfile | ||
| README.md | ||
| result-nod | ||
| treefmt.toml | ||
emacs-android-nix
Nix flake for building GNU Emacs for Android with optional Nix package manager integration.
Project Goals
- emacs-android: Reproducible build of upstream GNU Emacs for Android (unmodified)
- emacs-android-termux: Emacs + Termux fork pair with shared storage (matching developer ID/signing key)
- emacs-android-nix: Emacs + nix-on-droid pair with shared storage
- emacs-nix-android: Emacs with built-in Nix package manager (no companion terminal app)
- Sample configurations: Ready-to-use Emacs configs for Android with dependencies
Status
- Goal 1: Basic Emacs Android build
- Goal 2: Emacs + Termux shared storage
- Goal 3: Emacs + nix-on-droid shared storage
- Goal 4: Emacs with embedded Nix
- Goal 5: Sample configurations
Quick Start
# Enter development shell
nix develop
# Build Emacs for Android (arm64)
just build-emacs-arm64
# Build nix-on-droid with matching sharedUserId
just build-nod
# Verify both APKs have matching certificates
just verify-all
# Install both to connected Android device
just install-both
Architecture
emacs-android-nix/
├── flake.nix # Main flake (packageName, sharedUserId config)
├── keys/
│ └── debug.keystore # Shared signing key for both APKs
├── packages/
│ ├── default.nix # Package wiring
│ └── by-name/
│ ├── emacs-android/ # Emacs Android derivation
│ │ └── package.nix
│ └── nix-on-droid-app/ # nix-on-droid with patched sharedUserId
│ └── package.nix
├── Justfile # Build/install/verify recipes
└── .config/
├── android.nix # Android SDK/NDK setup
└── devshells/ # Development shell
Available Packages
| Package | Description |
|---|---|
emacs-android-arm64 |
Emacs for arm64 devices (default) |
emacs-android-armv7 |
Emacs for older ARM devices |
emacs-android-x86_64 |
Emacs for emulators |
nix-on-droid-app |
nix-on-droid with matching sharedUserId |
Shared Storage
Both Emacs and nix-on-droid are configured to share storage:
- Same
sharedUserId:org.gnu.emacs - Same signing certificate:
keys/debug.keystore
This allows both apps to access each other's internal storage at /data/data/org.gnu.emacs/.
Customization
Edit flake.nix to change the package ID:
packageName = "org.gnu.emacs"; # Change to your own ID
sharedUserId = "org.gnu.emacs"; # Must match for shared storage
If you change these, regenerate the keystore:
just gen-keystore
Useful Commands
# Build
just build-emacs-arm64 # Build Emacs APK
just build-nod # Build nix-on-droid APK
# Verify
just verify-all # Full verification (sharedUserId + certs)
just compare-certs # Compare signing certificates
just show-cert <apk> # Show certificate for any APK
# Install
just install-both # Install both APKs
just install-emacs # Install Emacs only
just install-nod # Install nix-on-droid only
# Emulator
just create-avd # Create test AVD
just emulator # Start headless emulator
just emulator-gui-direct # Start GUI emulator
Build Requirements
- Nix with flakes enabled
- Linux x86_64 host (cross-compilation to Android)
- ~10GB disk space for Android SDK/NDK
Android Support Matrix
| Package | Min API | Architecture | Notes |
|---|---|---|---|
| emacs-android | 21 (5.0) | arm64-v8a | Primary target |
| emacs-android | 21 (5.0) | armeabi-v7a | Legacy ARM |
| emacs-android | 21 (5.0) | x86_64 | Emulators |
References
License
GPL-3.0-or-later (same as GNU Emacs)