I’ve been trying to figure out if it’s possible to build our app - Status.im - for F-Droid in this GitHub issue:
And I’m having some serious issues trying to get anything to work. So I’m just going to ask here in case what I’m trying to do is actually impossible with F-Droid.
My understanding is that F-Droid is opinionated about how to run Gradle, and wants to run it itself, to build the APK. That does not seem compatible with how we build our app, which is using the Nix Package Manager.
Nix is a package manager that can be installed on top of any Linux OS and puts its files under /nix and requires root permissions to be installed.
The way we build it is via Nix derivation, that you can find the exact place where we run Gradle here:
The way that is called is for example via the release-android target in our Makefile:
I got some answers from lovely @licaon-kter at GigHub while working on my issue.
First of all I can avoid F-Droid wanting to run Gradle by NOT setting:
gradle:
- yes
Secondly, it appears that I will have available root permissions via the sudo metadata setting. So that means I can create the required /nix folder where Nix will be installed.
In case of using a Docker container I had to create the user and the folder with my own Dockerfile
FROM registry.gitlab.com/fdroid/docker-executable-fdroidserver:latest
RUN useradd -u 1000 builder
RUN mkdir -m 0755 /nix && chown builder /nix
If you’re using nix to setup gradle, then there are many ways to get
gradle setup, then the rest of the build would be standard. I see no
reason to tie a standard Android gradle build to any particular OS or
package manager.
If you’re doing other tricks with Nix, then you’ll be the pathfinder on
that one. All I’m saying is don’t expect things to just work with
non-standard Android build setups, and I wish you all the best with your
nix tricks.