✨ A modular Nix configuration with Flakes support for NixOS and Nix-on-Droid ❄️ Snowflake-inspired infrastructure for your systems
- For NixOS: NixOS 25.05 (Warbler) or newer, Flakes enabled in
/etc/nixos/configuration.nix:{ nix.settings.experimental-features = [ "nix-command" "flakes" ]; }
- For Nix-on-Droid: Android device with Nix-on-Droid installed from F-Droid.
# Generate hardware configuration
sudo rm -rf /etc/nixos/*; sudo nixos-generate-config
# Build and activate configuration
sudo nixos-rebuild switch --flake .#$(hostname) --impure# Clone the repository
nix run nixpkgs#git -- clone https://codeberg.org/ponfertato/nixcfg ~/.config/nixpkgs
# Build and activate configuration for your device
nix-on-droid switch --flake ~/.config/nixpkgs#potatoPhonenixcfg/
├── flake.nix # ❄️ Flakes entry point for NixOS and Nix-on-Droid
├── profiles/ # 🧩 Modular system profiles (base, desktop, users, etc.)
│ ├── base/ # 🖥️ Core system settings, Nix settings
│ ├── common/ # 👤 User configurations (groups, packages)
│ ├── desktop/ # 🖥️ Base GUI environment (KDE Plasma, X, audio, printing)
│ ├── laptop/ # 💻 Laptop-specific settings (Bluetooth, fingerprint)
│ ├── mobile/ # 📱 Common settings for Nix-on-Droid devices (packages, locale)
│ ├── networking/ # 🌐 Network and firewall settings
│ └── workstation/ # 💻 Workstation-specific settings (Wake-on-LAN)
├── hosts/ # 🖥️ Host-specific configs (hostname, kernel params, user packages)
│ ├── potatoLaptop/ # 💻 Configuration for potatoLaptop
│ │ └── default.nix # ⚙️ Host settings (hostname, kernelParams, packages)
│ ├── potatoWork/ # 💻 Configuration for potatoWork
│ │ └── default.nix # ⚙️ Host settings (hostname, kernelParams, packages)
│ ├── potatoPhone/ # 📱 Configuration for potatoPhone (Nix-on-Droid)
│ │ └── default.nix # ⚙️ Host settings (hostname, packages)
│ └── potatoTablet/ # 📱 Configuration for potatoTablet (Nix-on-Droid)
│ └── default.nix # ⚙️ Host settings (hostname, packages)
└── modules/ # 🧩 Reusable NixOS modules (Docker, Flatpak, Ollama)
├── docker.nix # 🐳 Docker configuration module
├── flatpak.nix # 📦 Flatpak configuration module
├── ollama.nix # 🤖 Ollama service configuration module
└── home-manager/ # 👤 Home Manager user environment
├── common.nix # 🏠 Core settings (bash, git, firefox, aliases)
├── packages.nix # 📦 User packages (apps, tools)
├── potatoLaptop.nix # 💻 Configuration for potatoLaptop (host-specific packages)
└── potatoWork.nix # 💻 Configuration for potatoWork (host-specific packages)
nix-update-inputs && nix-apply-system && nix-apply-usernix-apply-usernix-apply-systemnix-update-inputs# Update flake inputs (nixpkgs, hardware, etc.)
nix flake update
# Rebuild and activate the system (NixOS) with hardware config regeneration
sudo nixos-generate-config && sudo nixos-rebuild switch --flake .#$(hostname) --impure
# Rebuild and activate the system (Nix-on-Droid)
nix-on-droid switch --flake .#<device_name>nix-gcnix-search <package> # in stable (nixos-25.05)
nix-search-unstable <package> # in unstable- 🔄 Automatic Updates: Weekly GC and auto-upgrade (NixOS)
- 🧩 Modular Design: Easy to maintain and extend via profiles and separated modules
- 💻 Multi-Device Support: Share configs between NixOS and Nix-on-Droid machines
- 🛡️ Reproducible Builds: Fully declarative configuration with Flakes
- ⚙️ Optimized Nix Settings: Includes custom substituters for faster builds
- 👤 Declarative User Environment: Managed via Home Manager (apps, aliases, dotfiles)
- Add
profiles/new-profile/directory. - Create
profiles/new-profile/default.nixcontaining the NixOS or Nix-on-Droid module. - Import the profile in
flake.nixfor the desired host configuration.
- Add
modules/new-module.nix. - Import the module in
flake.nixfor the desired host configuration.
- Hardware-specific settings (kernel, CPU microcode, graphics drivers) are managed separately in
/etc/nixos/hardware-configuration.nix. - This file is typically generated by
nixos-generate-configand can be manually edited or supplemented withnixos-hardwaremodules if needed. - The configuration is included in
flake.nixto ensure reproducibility and compatibility withnixos-rebuild.
- Core settings (bash, git, firefox, aliases) are defined in:
modules/home-manager/common.nix - User packages are defined in:
modules/home-manager/packages.nix - Host-specific packages are defined in:
modules/home-manager/potatoWork.nix modules/home-manager/potatoLaptop.nix - After changes, apply with:
nix-apply-user