Skip to content

Latest commit

 

History

127 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nix-on-Droid Modular Configuration

Declarative mobile environment with Flakes 📱 Snowflake-inspired infrastructure for your Android devices


🚀 Quick Start

Requirements

  • Android device with Nix-on-Droid installed from F-Droid
  • Git available on the device (can be installed via nix run nixpkgs#git)
  • NixOS 24.05 compatible flake inputs

Initial Setup

# Clone the repository
nix run nixpkgs#git -- clone https://codeberg.org/ponfertato/nodcfg ~/.config/nixpkgs
cd ~/.config/nixpkgs

# Build and activate configuration for your device
nix-on-droid switch --flake ~/.config/nixpkgs#potatoPhone
# or
nix-on-droid switch --flake ~/.config/nixpkgs#potatoTablet

📂 Structure

nodcfg/
├── flake.nix                          # ❄️ Nix-on-Droid entry point + unstable overlay
├── profiles/                          # 🧩 Modular system profiles
│   ├── core/                          # 🖥️ Base: locale, nix settings, common packages
│   │   └── default.nix
│   └── user/                          # 👤 User roles (multi-user ready)
│       └── ponfertato/                # 👤 Current user profile
│           └── default.nix            #    Git config, shell aliases, user packages
└── hosts/                             # 📱 Host-specific configs
    ├── potatoPhone/                   # 📱 Phone-specific packages
    │   └── default.nix
    └── potatoTablet/                  # 📱 Tablet-specific packages
        └── default.nix

Symmetry with nixcfg

Path in nixcfg (NixOS) Path in nodcfg (Nix-on-Droid)
profiles/core/ profiles/core/
profiles/user/ponfertato/ profiles/user/ponfertato/
hosts/potatoWork/, hosts/potatoLaptop/ hosts/potatoPhone/, hosts/potatoTablet/

The same mental model applies to both repositories — only the system-level options differ (environment.systemPackages vs environment.packages, programs.firefox vs environment.etc."gitconfig", etc.).


🔄 Maintenance

Apply configuration (recommended)

nix-od

Update flake inputs

nix-update

Full update workflow

nix-update && nix-check && nix-od

Rollback to previous generation

nix-roll

Garbage Collection

nix-gc

Validate configuration

nix-check

Manual Update (if needed)

# Update flake inputs
nix flake update
# Rebuild and activate
nix-on-droid switch --flake ~/.config/nixpkgs#$(hostname)

Package Search

nix search nixpkgs <package>          # in stable (nixos-24.05)
nix search nixpkgs-unstable <package> # in unstable

✨ Key Features

  • 📱 Multi-Device Support: Share base config across potatoPhone and potatoTablet
  • 🛡️ Reproducible Builds: Fully declarative configuration with Flakes
  • ⚙️ Optimized Nix Settings: Yandex mirror + custom substituters for faster builds
  • 🔥 Unstable Overlay: Access pkgs.unstable.* without extra args
  • 👤 No Home Manager: Pure Nix-on-Droid via environment.packages, environment.etc, env.shellInit
  • 🔄 Easy Rollback: nix-roll to revert to previous generation
  • 🧹 Auto GC: Weekly garbage collection
  • 🔀 Symmetric with nixcfg: Same folder layout for easy navigation

🛠️ Customization

Add a new device

  1. Add hosts/<device_name>/default.nix
  2. Register it in flake.nix under nixOnDroidConfigurations
  3. Apply: nix-on-droid switch --flake .#<device_name>

Add packages

  • Common packages (all devices): edit profiles/core/default.nix
  • User-specific packages: edit profiles/user/ponfertato/default.nix
  • Device-specific packages: edit hosts/<device_name>/default.nix

Modify user settings

  • Git config: profiles/user/ponfertato/default.nixenvironment.etc."gitconfig"
  • Git ignores: profiles/user/ponfertato/default.nixenvironment.etc."gitignore_global"
  • Shell aliases: profiles/user/ponfertato/default.nixenv.shellInit

Add a new user role

  1. Create profiles/user/<username>/default.nix
  2. Import it from the desired host instead of ponfertato

About

Ponfertato Nix-on-Droid configuration with modular structure

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages