Nix flake for building GNU Emacs for Android with optional Nix package manager integration.
  • Nix 67.1%
  • Just 22.3%
  • Emacs Lisp 10.6%
Find a file
2025-12-18 03:01:14 -05:00
.config feat: build nix-on-droid 2025-12-18 03:01:13 -05:00
keys feat: build nix-on-droid 2025-12-18 03:01:13 -05:00
lib chore: initial commit 2025-12-17 22:33:23 -05:00
packages feat: build nix-on-droid 2025-12-18 03:01:13 -05:00
templates chore: initial commit 2025-12-17 22:33:23 -05:00
.copier-answers.yml chore: initial commit 2025-12-17 22:33:23 -05:00
.editorconfig chore: initial commit 2025-12-17 22:33:23 -05:00
.envrc chore: initial commit 2025-12-17 22:33:23 -05:00
.gitignore chore: initial commit 2025-12-17 22:33:23 -05:00
.ignore chore: initial commit 2025-12-17 22:33:23 -05:00
biome.json chore: initial commit 2025-12-17 22:33:23 -05:00
CLAUDE.md docs: update 2025-12-18 03:01:14 -05:00
cog.toml chore: initial commit 2025-12-17 22:33:23 -05:00
flake.lock feat: build nix-on-droid 2025-12-18 03:01:13 -05:00
flake.nix feat: build nix-on-droid 2025-12-18 03:01:13 -05:00
Justfile feat: build nix-on-droid 2025-12-18 03:01:13 -05:00
README.md docs: update 2025-12-18 03:01:14 -05:00
result-nod feat: build nix-on-droid 2025-12-18 03:01:13 -05:00
treefmt.toml chore: initial commit 2025-12-17 22:33:23 -05:00

emacs-android-nix

Nix flake for building GNU Emacs for Android with optional Nix package manager integration.

Project Goals

  1. emacs-android: Reproducible build of upstream GNU Emacs for Android (unmodified)
  2. emacs-android-termux: Emacs + Termux fork pair with shared storage (matching developer ID/signing key)
  3. emacs-android-nix: Emacs + nix-on-droid pair with shared storage
  4. emacs-nix-android: Emacs with built-in Nix package manager (no companion terminal app)
  5. 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)