Applications
Declare applications
One of the main features of Nix Android is declaring applications. Currently, the following methods are supported:
F-Droid and IzzyOnDroid
The F-Droid and IzzyOnDroid repositories are natively supported. This means that the different app versions are attached to different Flake versions. These are automatically updated and released daily by the Android Nix CI. This means that you still get reproducibility without worrying about downloading APKs or calculating hashes.
Each of the officially supported repositories has its own namespace within
android.apps:
- F-Droid:
android.apps.fdroid. - IzzyOnDroid:
android.apps.izzyondroid.
Package names are normalized by replacing the dot with an underscore. Thus,
org.videolan.vlc is turned into org_videolan_vlc.
{ android, ... }:
{
apps = with android.apps; [
fdroid.org_videolan_vlc
izzyondroid.com_geeksville_mesh
];
}
In order to update these apps, you need to run nix flake update.
Remote APKs
You can retrieve remote APKs with the lib.remoteApk function. If the hash does
not match, the evaluation will fail. Thus, it is recommended to use immutable URLs.
Tip
You can pre-compute the hash by running
nix store prefetch-file <URL>
{ android, ... }:
{
apps = with android.apps; [
(lib.remoteApk {
name = "org.lichess.mobileV2";
hash = "sha256-ai3sDnXyNK0QUOMix+/VaJBNDywJFT/dqQBlmPv6Qik=";
url = "https://f-droid.org/repo/org.lichess.mobileV2_300103.apk";
})
];
}
Local APKs
You can use local APKs with the lib.localApk function.
{ android, ... }:
{
apps = with android.apps; [
(lib.localApk {
name = "org.lichess.mobileV2";
src = ./applications/org.lichess.mobileV2_300103.apk;
})
];
}
Default applications
You can declare the default application for certain roles (e.g., browser) with
the defaultApps attribute. The name must be the role identifier and the key a
reference to an application (see above).
Note
You do not need to re-declare the applications in
apps. Android Nix de-duplicates both sets and derives the application bundle from them.
Tip
You can find all available roles in AOSP here: https://source.android.com/docs/core/permissions/android-roles
{ android, ... }:
{
defaultApps = with android.apps; {
"android.app.role.BROWSER" = fdroid.org_mozilla_fennec_fdroid;
};
}
Disable applications
{ android, ... }:
{
disabledApps = [
"com.android.egg"
];
}