Manage Android devices declaratively using Nix-on-Droid, bringing the power of NixOS-style configuration to mobile devices.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/soriphoono/homelab/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Nix-on-Droid configurations are stored in thedroids/ directory. Each directory is automatically discovered and exposed as a nixOnDroidConfiguration.
Prerequisites
Android Device Requirements
- Android device with ARM64 architecture (most modern devices)
- Termux installed from F-Droid (NOT Google Play Store)
- Storage permissions granted to Termux
- Stable internet connection
- At least 2GB free storage
Initial Device Setup
Before deploying configurations, set up Nix-on-Droid on your device:Install Termux
Download and install Termux from F-Droid.
Flake Configuration
The flake uses automatic discovery for Nix-on-Droid configurations:droids/ is automatically available for deployment.
Architecture Settings
Nix-on-Droid configurations are built foraarch64-linux using the nixpkgs-droid input:
Deployment from Android Device
Deploy directly on the Android device itself.Deployment from Desktop
Build configurations on a desktop machine and deploy to the device.Configuration Structure
Each Nix-on-Droid configuration should be structured as:Home Manager Integration
Nix-on-Droid includes integrated Home Manager support:Common Configuration Examples
Basic Configuration
With Home Manager
Flake Reference Format
Nix-on-Droid uses this flake reference:.refers to the current directory (flake root)#separates the flake reference from the output<device-name>matches directory name indroids/
Rollback and Recovery
List Generations
Rollback to Previous Generation
Switch to Specific Generation
Troubleshooting
Installation Issues
Problem: Nix installation fails on Android Solutions:- Ensure Termux is from F-Droid
- Grant storage permissions
- Check internet connectivity
- Ensure sufficient storage space
- Try clearing Termux cache
Build Failures
Problem: Configuration fails to build Solutions:- Run
nix flake checkfirst - Verify architecture is
aarch64-linux - Check that all packages support ARM64
- Review error messages for unsupported packages
- Test build on desktop:
nix build .#nixOnDroidConfigurations.<device-name>.activationPackage
Storage Issues
Problem: Running out of storage Solutions:Package Not Available
Problem: Package doesn’t work on Android Solutions:- Some packages don’t support ARM64 or Android
- Check if package is in
aarch64-linuxcache - Consider alternatives or building from source
- Review package meta.platforms
Performance Considerations
Optimization Tips
-
Use Binary Caches: Configure substituters to avoid building on device
- Minimize Packages: Only install essential packages on device
- Build Remotely: Build on desktop when possible
- Cleanup Regularly: Remove old generations to save space
Remote Access
Configure SSH for remote access to your Android device:Best Practices
- Test configurations on desktop first
- Keep device configs minimal
- Use binary caches to avoid local builds
- Regularly clean old generations
- Backup important data before major changes
- Monitor storage usage
- Keep Termux and Nix updated
Next Steps
- Validation - Pre-deployment validation
- NixOS Systems - Deploy full systems
- Home Manager - User configurations