Skip to main content
Nix-on-Droid modules adapt the homelab configuration system for Android devices using Nix-on-Droid.

Overview

The Droid modules provide:
  • User profile integration with the home configuration system
  • Nix configuration optimized for mobile devices
  • Automatic home module imports for compatible configurations

Module Structure


User Management

The users module integrates Nix-on-Droid with the home configuration system.

Options

string
default:"null"
The username for the Nix-on-Droid environment.
package
default:"pkgs.bashInteractive"
The shell to use for the user.

Home Manager Integration

When a username is set, the module automatically imports home configurations from:
  1. homes/<username>/default.nix - Primary user configuration
  2. homes/<username>@global/default.nix - Global settings across all platforms
  3. homes/<username>@droid/default.nix - Droid-specific overrides
The module checks for existence and only imports paths that exist.

Shell Integration

The Fish shell is automatically enabled in Home Manager when selected:

Example Configuration

This will:
  • Set the user shell to Fish
  • Import homes/soriphoono/default.nix
  • Import homes/soriphoono@global/default.nix (if exists)
  • Import homes/soriphoono@droid/default.nix (if exists)
  • Enable Fish shell in Home Manager

Nix Configuration

Optimized Nix daemon settings for mobile devices.

Installed Packages

Git is installed by default for version control operations.

Nix Settings

The module configures Nix with mobile-optimized settings:

Experimental Features

Enables:
  • nix-command - New nix CLI interface
  • flakes - Flake support for reproducible configurations

Flake Registry

Disables the global flake registry (opinionated default).

Resource Limits

Limits build jobs to 2 CPU cores to prevent out-of-memory errors during intensive compilations (e.g., browser builds).

Trusted Users

Grants the configured user trusted access to the Nix daemon.

Binary Caches

Configures trusted binary caches:
  • cache.nixos.org - Official NixOS cache
  • nix-community.cachix.org - Community packages
  • numtide.cachix.org - Numtide packages

Flake Registry and Nix Path

The module automatically syncs the flake registry and NIX_PATH with flake inputs:
This ensures nix-channel and legacy Nix commands work with flake inputs.

Home Module Compatibility

Nix-on-Droid can use most home modules with some adaptations:

Compatible Modules

  • Core Modules (with adjustments):
    • Git configuration
    • Secrets management
    • Shell configuration (Fish, Starship)
    • SSH management
  • User Applications:
    • Development tools (Neovim, editors)
    • Terminal applications
    • CLI utilities

Incompatible Features

  • Fastfetch - Disabled on Droid (isDroid parameter)
  • GUI Applications - Browsers, GUI editors, desktop apps
  • System Services - SystemD user services (use Termux services instead)
  • XDG MIME types - No desktop environment integration

Droid-Specific Adaptations

Modules can detect Droid environment:
The isDroid parameter is passed to home modules automatically.

Complete Example

A full Nix-on-Droid configuration:

Directory Structure

Recommended structure for Droid configurations:
The @global and @droid suffixes create isolated configuration contexts:
  • @global - Applied to all platforms (desktop, servers, mobile)
  • @droid - Only applied to Nix-on-Droid installations
  • Base name - Typically used for primary desktop configuration

Best Practices

Resource Management

Mobile devices have limited resources:

Lightweight Configurations

Prefer CLI tools over GUI applications:

Separate Concerns

Use the @droid suffix for mobile-specific configurations:

Test Incrementally

Nix-on-Droid builds can be slow. Test modules incrementally:

Troubleshooting

Build Failures

Out of Memory (OOM) If builds fail with OOM errors:
Missing Substitutes If packages aren’t available in binary caches:

Module Import Errors

Path Not Found Verify the home configuration paths exist:
Incompatible Options Some NixOS options don’t work on Droid. Check the module’s platform compatibility.