Declarative Android, with Nix

Configure your phone the way you configure NixOS.

Nixup manages a rooted Android phone from a single configuration.nix: apps, app settings, system settings, services and backups. Every build is checked before anything changes, and every change can be rolled back.

Free and open source under GPL-3.0 · Android 11+ · arm64 · Magisk, KernelSU or APatch

configuration.nix
{ pkgs, ... }: {
  # Apps from F-Droid, IzzyOnDroid, GitHub releases or Google Play
  android.packages.fdroid = with pkgs.fdroid; [ com.termux ];
  android.packages.playstore = [ "org.telegram.messenger" ];

  # Per-app permissions, battery use and default apps
  android.apps."org.thoughtcrime.securesms".permissions.camera = true;

  # System settings, with NixOS's names where they exist
  time.timeZone = "Europe/Istanbul";
  android.settings.display.darkMode = true;

  # NixOS services, running on the phone
  services.tailscale.enable = true;
  services.syncthing.enable = true;

  # Encrypted backups of apps and folders
  android.backup = {
    repository = "/storage/XXXX-XXXX/Backup";
    passwordFile = ./backup-password;
    apps = [ "org.thoughtcrime.securesms" ];
  };
}

Nixup is in active development. Back up your phone before you start. The project comes with no warranty and is not responsible for data loss.

Why Nixup

NixOS runs on only a few phones, and Nix-on-Droid cannot manage Android itself. Nixup fills the gap: it keeps Android and your apps, and gives Nix the permissions to manage them.

01

One file describes the phone

Apps, permissions, settings, services and backups live in one config you can keep in git and share with your NixOS machines.

02

Checked before anything changes

A build reads and checks the whole config first. A typo, a missing app or a wrong key stops it, and nothing on the phone is touched.

03

Every change can be undone

Each build is saved as a generation you can switch back to. Remove a line, and the setting returns to how it was before Nixup.

What it manages

The parts of a phone you usually set up by hand, written down once.

Apps from repositories

Install and update apps from F-Droid, IzzyOnDroid, custom F-Droid repositories, and GitHub, GitLab or Codeberg releases. Every APK is checked against its checksum and signing key.

Repositories and apps →

Google Play, without Google Play

Download apps from Google Play the way Aurora Store does. No Play Store, Play services or GApps on the phone, only an account.

Google Play →

App settings

Permissions, battery use, background data, special access, default apps, per-app language. Remove or disable apps the phone came with.

App settings →

System settings

Display, navigation, sound, time, language and LineageOS options, with NixOS's names where they exist. Each setting is read back to confirm it took.

System settings →

Packages and terminal

Programs from nixpkgs in a built-in root terminal, over SSH or adb. Nix itself is there too: nix shell, nix profile, nix-shell.

Packages and terminal →

Services and timers

NixOS-style systemd.services, timers, sockets and path units, run by Nixup itself. They start at boot and restart when they fail.

Services and scripts →

NixOS service modules

Over sixty of nixpkgs' own modules run as they are: Syncthing, Tailscale, SSH, Jellyfin, Vaultwarden, nginx, ntfy, AdGuard Home and more.

Ready-made services →

Encrypted backups

Apps (APK and data) and folders backed up by the phone with restic, after use and daily. Restore one app, or a whole new phone.

Backups →

Generations and rollback

Build, dry run, upgrade and roll back like nixos-rebuild, from the app or from a PC over adb or SSH.

Building and rollback →

Works like nixos-rebuild

If you know NixOS, you already know the workflow. Build from the app, or from a computer.

NixOSNixup
nixos-rebuild switchBuild in the app
nixos-rebuild dry-activateDry run
nixos-rebuild switch --upgradeUpgrade
nixos-rebuild switch --rollbackGenerations, then switch to one
nixos-rebuild --target-hostnixup-rebuild switch --flake .#phone on a PC

Get started

Nixup installs as a root module and comes with its own app.

Install

  1. Root the phone

    Magisk (tested), KernelSU or APatch.

  2. Download the module

    nixup-v<version>.zip from the releases page.

  3. Install it

    Magisk → Modules → Install from storage → pick the zip.

  4. Restart the phone
  5. Open Nixup

    Allow root and notifications, then press New for a starter config.

Requirements

  • A rooted phone with Magisk, KernelSU or APatch.
  • Android 11 or newer, 64-bit ARM (arm64).
  • A network connection for builds.
  • Nix on a PC only if you want to build there.

Start a config on a PC

nix flake init -t github:by-architect/Nixup

Removing the module puts back every setting Nixup changed and every app it removed. How uninstalling works.

Write it down once.

Read the full documentation for every option, or start from the template, which lists them all.