Gundroid = Guix + Android ♥
This channel contains: cli-tools, emulator and android-studio.
Originally took Android Studio launching example from Julien Lepiller (@roptat) blogpost. You can also take a look on his guix-android channel.
Before lauching the emulator the followings needs to be properly packed (patchelf’ed) and expose proper binaries:
- [X] cli-tools (apkanalyzer, avdmanager, lint, retrace, sdkmanager)
- [ ] emulator (emulator, mksdcard)
- [ ] build-tools (aapt2, apksigner, zipalign)
- [ ] platform-tools (adb, etc1tool, fastboot, logcat)
(see (1) as reference)
Even having it packed propely emulator won’t work, because it would expect envvar ANDROID_HOME
set propely and the content of this directory to replicate exact file-system structure (from (1)):
- commandline tools bins: cmdline-tools/version/bin/
- build tools bins: build-tools/version
- emulator’s bins: emulator
- platform-tools bins: platform-tools
This can be done by creating guix service after packing all them propely.
Currently launching Android Studio easily from the package itself is not implemented. It can be launched in a container. Assuming you are at this channel’s root directory do the following:
- Build the
studio
package and get it’s store pathguix build -f gundroid/studio.scm -L. ... /gnu/store/...-android-studio-2022.1.1.19
- Launch the container and bash into it
guix shell -C -F -N -L. \ -e "(@@ (gundroid packages studio) studio)" \ --share=$XAUTHORITY --share=/tmp/.X11-unix \ --share=/dev/shm --expose=/etc/machine-id \ --share=$HOME --share=/dev/kvm \ --preserve=XAUTHORITY --preserve=DISPLAY \ -m $PWD/gundroid/manifest.scm \ -- bash
- Go to studio’s store path being in the container and launch the studio
cd /gnu/store/...-android-studio-2022.1.1.19 ./bin/studio.sh
But even with this the emulator inside the studio won’t work. You have to propely set up Android envvars (ANDOID_HOME
and PATH
) to integrate with emulator
and cli-tools
: see environment variables reference on android’s doc page.
The best way to make the studio work would be to add emulator and cli-tools as packages’s inputs and create separate gexp-script to automatically lauch it in a container (see nonguix steam example) with the customizable environment vars set where’d user like to have their ANDROID_HOME
.
This channels includes nonfree software!
Please do NOT promote this repository on any official Guix communication channels, such as their mailing lists or IRC channel, even in response to support requests! This is to show respect for the Guix project’s strict policy against recommending nonfree software, and to avoid any unnecessary hostility.