Repository navigation
Commit e767792
committed
feat(devel/android): Add Android development home service
Installs Android CLI, Android Studio and a JDK for Gradle, and sets the
environment Android tooling expects. JAVA_HOME needs the "jdk" output
specifically: openjdk's default output is a JRE carrying no javac, so
the field holds a (package output) pair and the value is built with
gexp-input -- file-append only ever names the default output. For the
same reason $ANDROID_HOME is spelled with $HOME rather than a tilde:
environment values are emitted double-quoted with `$' preserved and `~'
left alone. SDK directories are appended to PATH, never prepended;
platform-tools and cmdline-tools ship a sqlite3, an mke2fs and a lint
that would otherwise shadow the profile's in every shell.
The bulk of the module is android-sdk-patch, which repoints the prebuilt
FHS binaries the SDK downloads at the store. What it does is shaped
almost entirely by patchelf's limits on this input:
- RUNPATH is a *single* store path -- a computed-file of symlinks --
plus a fixed $ORIGIN ladder. Spelling out thirty directories gave a
two-kilobyte string, and patchelf 0.18 cannot grow a non-PIE ET_EXEC
to fit it: it either aborts on `Assertion splitIndex == -1' in
shiftFile or, worse, exits 0 having produced a segfaulting file.
emulator/bin64/e2fsck was corrupted exactly that way.
- Every patch is therefore verified by loading the result through
ld.so before it replaces the original, and written through a sibling
temp file so an interrupted run cannot leave a half-written ELF.
Death by signal means corruption; exit 127 does not -- the emulator's
vendored Qt only finds its siblings once the emulator sets its own
search path.
- The $ORIGIN ladder is constant. Carrying over the file's existing
$ORIGIN entries made the ladder re-append itself on every run, so
the RUNPATH grew without bound and nothing was ever idempotent.
- Directories named after an Android ABI are skipped: the RenderScript
runtime under build-tools/*/renderscript/lib/*/ is copied into the
APK, and a host RUNPATH there would displace Android's own libc,
libm and liblog.
Idempotency is decided by exact comparison against the current target,
never by a /gnu/store prefix: after a guix pull and a gc the interpreter
a file points at is gone, yet a prefix test would call it done and never
repair it. --check, --dry-run, --missing and --verbose exist because
picking the library set is an iterative job and a bare count of patched
files says nothing about why something still will not start.
sdk-components records which SDK packages are wanted so that intent
lives in git next to home.scm; the bytes themselves come from the
network and guix home roll-back does not revert them.
Telemetry is opted out through ~/.android/analytics.settings, seeded
from an activation hook rather than home-files: Android CLI rewrites
that file, and a symlink into the store would fail.1 parent f45aeb6 commit e767792
1 file changed
Lines changed: 703 additions & 0 deletions
0 commit comments