This repository contains a modular NixOS configuration that supports multiple hosts and separates concerns into logical modules.
See the docs/ directory for complete documentation:
- Documentation Index - Start here
- Daily Operations - Essential commands
- Host Management - Multiple machines
- User Management - Multiple users
- Package Management - Installing software
- Module Creation - Creating modules
# Clone the repository
git clone https://github.com/yourusername/dotfiles ~/.dotfiles
cd ~/.dotfiles
# Build and switch to configuration
sudo nixos-rebuild switch --flake .
# Update packages
nix flake update
.dotfiles/
├── flake.nix # Entry point - defines all hosts
├── flake.lock # Pinned dependencies
├── hosts/ # Host-specific configurations
│ └── my-nixos/ # Per-machine settings
├── modules/ # Reusable configuration modules
│ ├── wm/ # Window managers
│ ├── gui/ # GUI applications
│ └── tui/ # Terminal applications
├── home/ # User configurations
│ └── tai/ # Per-user settings
└── docs/ # Documentation
Task | Command |
---|---|
Rebuild | sudo nixos-rebuild switch --flake . |
Update | nix flake update |
Rollback | sudo nixos-rebuild switch --rollback |
Garbage collect | sudo nix-collect-garbage -d |
- New host? See Host Management
- New user? See User Management
- New package? See Package Management
- New module? See Module Creation
.dotfiles/
├── flake.nix # Main flake configuration
├── flake.lock # Flake lock file
├── hosts/ # Host-specific configurations
│ └── my-nixos/ # Configuration for "my-nixos" host
│ ├── configuration.nix
│ └── hardware-configuration.nix
├── modules/ # Reusable modules
│ ├── wm/ # Window managers
│ │ └── hyprland/ # Hyprland configuration
│ │ ├── default.nix # System-level config
│ │ └── home.nix # User-level config
│ ├── gui/ # GUI applications
│ │ ├── browsers/ # Web browsers
│ │ └── 1password/ # Password manager
│ └── tui/ # Terminal UI applications
│ ├── nvim/ # Neovim configuration
│ ├── kitty/ # Kitty terminal
│ ├── cli-tools/ # Command-line utilities
│ ├── git/ # Git configuration
│ └── starship/ # Shell prompt
└── home/ # User-specific configurations
└── tai/ # Configuration for user "tai"
└── home.nix # Home-manager configuration
To build and switch to the configuration:
sudo nixos-rebuild switch --flake .#my-nixos
Or let it auto-detect your hostname:
sudo nixos-rebuild switch --flake .
See the Multiple Hosts Guide for detailed instructions on adding new machines.
- Create a new directory under the appropriate category in
modules/
- Add a
default.nix
file with your module configuration - For home-manager modules, you may also add a
home.nix
file - Import the module in either host configuration or user home configuration
- wm/: Window managers and desktop environments
- gui/: Graphical applications
- tui/: Terminal-based applications and tools
- Modular design for easy maintenance and reusability
- Support for multiple hosts
- Separation of system and user configurations
- Organized by application type (GUI/TUI/WM)